|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
不知道怎么回事,这个总是查到的是空值,为何?
sql = "SELECT In_Info.p_ID,In_Info.p_name,In_Info.p_gg,In_Info.p_unit,"
sql = sql & "IIF(ISNULL(AA.进货数量合计),0,AA.进货数量合计)-IIF(ISNULL(BB.销售数量合计),0,BB.销售数量合计) as 数量,"
sql = sql & "IIF(ISNULL(AA.进货金额合计),0,AA.进货金额合计)-IIF(ISNULL(BB.销售金额合计),0,BB.销售金额合计) as 金额 "
sql = sql & "from( In_Info left JOIN (select In_Info.p_ID,B.进货数量合计,B.进货金额合计"
sql = sql & " from In_Info left JOIN (select In_info.p_ID,sum(In_qty) as 进货数量合计,sum(In_amt) as 进货金额合计"
sql = sql & " from In_info where In_info.In_date<#" & Me.DTPicker1.Value & "# group by In_info.p_ID ) B on In_Info.p_ID=B.p_ID) AA on In_Info.p_ID=AA.p_ID )"
sql = sql & " left JOIN (select In_Info.p_ID,A.销售数量合计,A.销售金额合计 from In_Info left JOIN (SELECT Out_info.p_ID,SUM(Out_qty) AS 销售数量合计,sum(Out_amt) as 销售金额合计"
sql = sql & " from Out_info where Out_info.Out_date<# " & Me.DTPicker1.Value & "# group by Out_info.p_ID ) A on In_Info.p_ID=A.p_ID) BB on In_Info.p_ID=BB.p_ID "
|
|