1

在 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

但是当我group by在sql中添加时出现错误:

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 中使用它?

4

1 回答 1

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
于 2013-04-23T12:13:12.053 回答