我如何在aspx.vb中通过sql添加组

时间:2021-06-05 23:54:20

IN SQL:

在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

I had change that and this work in aspx.vb:

我改变了这一点,并在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

But I have error when I add the group by in the sql:

但是当我在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

How can I use that in one sql?

我怎样才能在一个sql中使用它?

1 个解决方案

#1


1  

Just remove WHERE

只需删除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

#1


1  

Just remove WHERE

只需删除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