2013-04-23 67 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