sqlml="SELECT a1.编码,a1.名称,"
sqlml=+sqlml+"IIF(ISNULL(b1.本月发出),0,b1.本月发出) as 本月发出,"
sqlml=+sqlml+"IIF(ISNULL(c1.本月开票),0,c1.本月开票) as 本月开票,"
sqlml=+sqlml+"IIF(ISNULL(d1.本月回款),0,d1.本月回款) as 本月回款,"
sqlml=+sqlml+"IIF(ISNULL(b2.累计发出),0,b2.累计发出) as 累计发出,"
sqlml=+sqlml+"IIF(ISNULL(c2.累计开票),0,c2.累计开票) as 累计开票,"
sqlml=+sqlml+"IIF(ISNULL(d2.累计回款),0,d2.累计回款) as 累计回款 from 客户编码 a1 "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 本月发出 from 发出商品 where 日期 BETWEEN #&ycrq.# and #&jsrq.# group by khbm)b1 on a1.编码=b1.khbm "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 本月开票 from 开票信息 where 开票日期 BETWEEN #&ycrq.# and #&jsrq.# group by khbm)c1 on a1.编码=c1.khbm "
sqlml=+sqlml+"left join (select khbm,sum(回款金额) as 本月回款 from 回款信息 where 日期 BETWEEN #&ycrq.# and #&jsrq.# group by khbm)d1 on a1.编码=d1.khbm "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 累计发出 from 发出商品 where 日期 BETWEEN #&ncrq.# and #&jsrq.# group by khbm)b2 on a1.编码=b2.khbm "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 累计开票 from 开票信息 where 开票日期 BETWEEN #&ncrq.# and #&jsrq.# group by khbm)c2 on a1.编码=c2.khbm "
sqlml=+sqlml+"left join (select khbm,sum(回款金额) as 累计回款 from 回款信息 where 日期 BETWEEN #&ncrq.# and #&jsrq.# group by khbm)d2 on a1.编码=d2.khbm "
sqlml=+sqlml+"order by a1.编码"
IF SQLEXEC(mycon1,sqlml,'lsk')<0
errmsg()
RETURN
ENDIF
BROWSE
USE IN lsk
这样提示错误,不知道怎么办才行??
sqlml=+sqlml+"IIF(ISNULL(b1.本月发出),0,b1.本月发出) as 本月发出,"
sqlml=+sqlml+"IIF(ISNULL(c1.本月开票),0,c1.本月开票) as 本月开票,"
sqlml=+sqlml+"IIF(ISNULL(d1.本月回款),0,d1.本月回款) as 本月回款,"
sqlml=+sqlml+"IIF(ISNULL(b2.累计发出),0,b2.累计发出) as 累计发出,"
sqlml=+sqlml+"IIF(ISNULL(c2.累计开票),0,c2.累计开票) as 累计开票,"
sqlml=+sqlml+"IIF(ISNULL(d2.累计回款),0,d2.累计回款) as 累计回款 from 客户编码 a1 "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 本月发出 from 发出商品 where 日期 BETWEEN #&ycrq.# and #&jsrq.# group by khbm)b1 on a1.编码=b1.khbm "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 本月开票 from 开票信息 where 开票日期 BETWEEN #&ycrq.# and #&jsrq.# group by khbm)c1 on a1.编码=c1.khbm "
sqlml=+sqlml+"left join (select khbm,sum(回款金额) as 本月回款 from 回款信息 where 日期 BETWEEN #&ycrq.# and #&jsrq.# group by khbm)d1 on a1.编码=d1.khbm "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 累计发出 from 发出商品 where 日期 BETWEEN #&ncrq.# and #&jsrq.# group by khbm)b2 on a1.编码=b2.khbm "
sqlml=+sqlml+"left join (select khbm,sum(金额) as 累计开票 from 开票信息 where 开票日期 BETWEEN #&ncrq.# and #&jsrq.# group by khbm)c2 on a1.编码=c2.khbm "
sqlml=+sqlml+"left join (select khbm,sum(回款金额) as 累计回款 from 回款信息 where 日期 BETWEEN #&ncrq.# and #&jsrq.# group by khbm)d2 on a1.编码=d2.khbm "
sqlml=+sqlml+"order by a1.编码"
IF SQLEXEC(mycon1,sqlml,'lsk')<0
errmsg()
RETURN
ENDIF
BROWSE
USE IN lsk
这样提示错误,不知道怎么办才行??