P
ptfjy
Unregistered / Unconfirmed
GUEST, unregistred user!
S:='SELECT a.id, a.货物名称 as 货物名称, a.规格, a.型号, a.颜色, a.千重, b.入库数量, c.出库数量,'; S:=S+' a.数量 AS 库存数量, b.入库金额,c.出库金额 '; S:=S+' FROM dbo.库存表 a LEFT OUTER JOIN '; S:=S+' (SELECT dbo.入库表明细.库存ID, SUM(dbo.入库表明细.数量) AS 入库数量,'; S:=S+' SUM(dbo.入库表明细.金额) AS 入库金额'; S:=S+' FROM dbo.入库表主 INNER JOIN'; S:=S+' dbo.入库表明细 ON dbo.入库表主.编号 = dbo.入库表明细.编号'; S:=S+' WHERE (dbo.入库表主.日期>=:fromdate) and (dbo.入库表主.日期<=:ToDate)'; S:=S+' GROUP BY dbo.入库表明细.库存ID) b ON a.id = b.库存ID LEFT OUTER JOIN'; S:=S+' (SELECT dbo.出库表明细.库存ID, SUM(dbo.出库表明细.数量) AS 出库数量,'; S:=S+' SUM(dbo.出库表明细.金额) AS 出库金额'; S:=S+' FROM dbo.出库表主 INNER JOIN'; S:=S+' dbo.出库表明细 ON dbo.出库表主.编号 = dbo.出库表明细.编号'; S:=S+' WHERE (dbo.出库表主.日期>=:fromdate1) and (dbo.出库表主.日期<=:ToDate1)'; S:=S+' GROUP BY dbo.出库表明细.库存ID) c ON a.id = c.库存ID ';--------------------------------------------因为我想显示某一个货物名称的信息。所以加了下面这一句。 S:=S+' where (a.货物名称 like :HWMQ) ;-----------------------------------------------但是,加了上面的那句后,没有效果。请问该怎么办法?谢谢!