IN SQL:
select SE.shipperId, SUM(SEDetail.totalSize) as CBM from SE, SEDetail
where SEDetail.shipperId=10011 and SE.id = SEDetail.bolId and SEDetail.containerId
between 1 and 5 group by SE.shipperID
我已经改变了,这在aspx.vb中起作用:
SELECT SE.shipperID as 'Shipper ID', SUM(SEDetail.totalSize) as CBM
FROM SE inner join SEDetail on SE.id = SEDetail.bolId and SEDetail.containerId
between 1 and 5 Where
但是当我在sql:
中添加group by
时出错
SELECT SE.shipperID as 'Shipper ID', SUM(SEDetail.totalSize) as CBM
FROM SE inner join SEDetail on SE.id = SEDetail.bolId and SEDetail.containerId
between 1 and 5 Where group by SE.shipperID
如何在一个sql中使用它?
答案 0 :(得分:1)
只需删除WHERE
SELECT SE.shipperID as 'Shipper ID', SUM(SEDetail.totalSize) as CBM
FROM SE inner join SEDetail on SE.id = SEDetail.bolId WHERE SEDetail.containerId
between 1 and 5 group by SE.shipperID