select shiph.ordid as 合同编号,longname as 客户名称, ordh12 as 工程名称 ,sum(ordb.qty) as 合同签约方量 , sum(ph28) as 当月销货方量 , sum(ph19) as 当月销货进金额 from ordh,cust,shiph,ordb where cust.custid=ordh.custid and ordh.ordid=shiph.ordid and ordb.ordid=shiph.ordid and shipdate between 20020926 and 20021025 order by shipdate group by shiph.ordid,longname,ordh12 报错:Server: Msg 156, Level 15, State 1, Line 5 Incorrect syntax near the keyword 'group'. 这是为什么能帮忙吗?谢谢了
to cooket; 把 order by 放在group by 后面!
select shiph.ordid as 合同编号,longname as 客户名称, ordh12 as 工程名称 ,sum(ordb.qty) as 合同签约方量 , sum(ph28) as 当月销货方量 , sum(ph19) as 当月销货进金额 from ordh,cust,shiph,ordb where cust.custid=ordh.custid and ordh.ordid=shiph.ordid and ordb.ordid=shiph.ordid and shipdate between 20020926 and 20021025 order by shipdate group by shiph.ordid,longname,ordh12 order by shipdate语法是对了,不够高效!
from ordh,cust,shiph,ordb
where cust.custid=ordh.custid and ordh.ordid=shiph.ordid and ordb.ordid=shiph.ordid and shipdate between 20020926 and 20021025
order by shipdate
group by shiph.ordid,longname,ordh12
报错:Server: Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'group'.
这是为什么能帮忙吗?谢谢了
把 order by 放在group by 后面!
from ordh,cust,shiph,ordb
where cust.custid=ordh.custid and ordh.ordid=shiph.ordid and ordb.ordid=shiph.ordid and shipdate between 20020926 and 20021025
order by shipdate
group by shiph.ordid,longname,ordh12
order by shipdate语法是对了,不够高效!