2013-04-23 79 views
1

添加組SQL:如何我可以通過SQL在aspx.vb

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?

+2

刪除從哪里哪里,你應該通過 – Satya 2013-04-23 12:09:03

回答

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 
+0

1和5之間。當我刪除了哪裏,錯誤的是附近有語法錯誤「SE」。 – 2013-04-23 12:24:03

+0

查看更新的答案...我已經通過WHERE子句 – Pranav 2013-04-23 12:29:48

+0

刪除了「and」條件我也不能在aspx.vb中使用它,現在錯誤是'='附近的錯誤語法。 – 2013-04-23 12:38:57