一查询就提示说.关键字 as 附近有语法错误.我看了好几遍.在sql 2000 上也试了都没问题.怎么一到delphi就出错了.
chaxun.sql.Add('a.spdm as 商品代码,jiage as 价格,nianfen as 年份,jjmc as 季节,dlmc as 大类,ppmc as 品牌,dh as 订货,jh as 进货,th as 退货 from vw_item as a ');
chaxun.sql.Add('left join (select spdm,sum(sl) as jh from spjhdmx where djbh in (select djbh from spjhd)group by spdm) as b on a.spdm=b.spdm');
chaxun.sql.Add('left join (select spdm,sum(sl) as th from spthdmx where djbh in (select djbh from spthd)group by spdm) as c on a.spdm=c.spdm');
chaxun.sql.Add('left join (select spdm,sum(sl) as dh from jordermx where djbh in (select djbh from jorder)group by spdm) as d on a.spdm=d.spdm');
chaxun.sql.Add('where dh is not null or jh is not null or th is not null or dh!=0 or th!=0 or jh!=0');
chaxun.sql.Add('a.spdm as 商品代码,jiage as 价格,nianfen as 年份,jjmc as 季节,dlmc as 大类,ppmc as 品牌,dh as 订货,jh as 进货,th as 退货 from vw_item as a ');
chaxun.sql.Add('left join (select spdm,sum(sl) as jh from spjhdmx where djbh in (select djbh from spjhd)group by spdm) as b on a.spdm=b.spdm');
chaxun.sql.Add('left join (select spdm,sum(sl) as th from spthdmx where djbh in (select djbh from spthd)group by spdm) as c on a.spdm=c.spdm');
chaxun.sql.Add('left join (select spdm,sum(sl) as dh from jordermx where djbh in (select djbh from jorder)group by spdm) as d on a.spdm=d.spdm');
chaxun.sql.Add('where dh is not null or jh is not null or th is not null or dh!=0 or th!=0 or jh!=0');
chaxun.sql.Add(' a.spdm as 商品代码,jiage as 价格,nianfen as 年份,jjmc as 季节,dlmc as 大类,ppmc as 品牌,dh as 订货,jh as 进货,th as 退货 from vw_item as a ');
chaxun.sql.Add(' left join (select spdm,sum(sl) as jh from spjhdmx where djbh in (select djbh from spjhd)group by spdm) as b on a.spdm=b.spdm ');
chaxun.sql.Add(' left join (select spdm,sum(sl) as th from spthdmx where djbh in (select djbh from spthd)group by spdm) as c on a.spdm=c.spdm ');
chaxun.sql.Add(' left join (select spdm,sum(sl) as dh from jordermx where djbh in (select djbh from jorder)group by spdm) as d on a.spdm=d.spdm ');
chaxun.sql.Add(' where dh is not null or jh is not null or th is not null or dh!=0 or th!=0 or jh!=0 ');