sql语句执行结果错误,帮看下是什么原因? 5
下面的语句在SQLserver中使用,计算的结果错误,请问哪里写错了?sql="selectSuppliersInfo.工程名称,SuppliersInfo.供应商名称,...
下面的语句在SQL server中使用,计算的结果错误,请问哪里写错了?
sql = "select SuppliersInfo.工程名称,SuppliersInfo.供应商名称,paylog.单位,sum(materiallog.数量*materiallog.单价) as 材料应付金额,sum(plantlog.数量*plantlog.单价) as 植物应付金额,sum(paylog.支付金额) as 已付金额 from SuppliersInfo"
sql = sql & " left join paylog on SuppliersInfo.工程名称=paylog.工程名称 and SuppliersInfo.供应商名称=paylog.收款单位"
sql = sql & " left join materiallog on SuppliersInfo.工程名称=materiallog.工程名称 and SuppliersInfo.供应商名称=materiallog.供应商名称"
sql = sql & " left join plantlog on SuppliersInfo.工程名称=plantlog.工程名称 and SuppliersInfo.供应商名称=plantlog.供应商名称"
sql = sql & " group by SuppliersInfo.工程名称,SuppliersInfo.供应商名称,paylog.单位"
rs.Open sql, cn, adOpenKeyset, adLockReadOnly
谢谢 展开
sql = "select SuppliersInfo.工程名称,SuppliersInfo.供应商名称,paylog.单位,sum(materiallog.数量*materiallog.单价) as 材料应付金额,sum(plantlog.数量*plantlog.单价) as 植物应付金额,sum(paylog.支付金额) as 已付金额 from SuppliersInfo"
sql = sql & " left join paylog on SuppliersInfo.工程名称=paylog.工程名称 and SuppliersInfo.供应商名称=paylog.收款单位"
sql = sql & " left join materiallog on SuppliersInfo.工程名称=materiallog.工程名称 and SuppliersInfo.供应商名称=materiallog.供应商名称"
sql = sql & " left join plantlog on SuppliersInfo.工程名称=plantlog.工程名称 and SuppliersInfo.供应商名称=plantlog.供应商名称"
sql = sql & " group by SuppliersInfo.工程名称,SuppliersInfo.供应商名称,paylog.单位"
rs.Open sql, cn, adOpenKeyset, adLockReadOnly
谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询