2017-09-16 41 views
-3
select Products.prodname, 
     sum(billdetail.Qty) as qty, 
     BillDetail.rate, 
     sum(billdetail.amt) as Amt 
from billdetail 
inner join products on products.prodid = billdetail.prodid 
inner join category on category.catid = products.catid 
group by prodname, rate 
where CatName = "Chicken"; 
+0

这里是组 SELECT列名(S) 的语法FROM table_name的 –

+1

如果在问题中包含错误文本,它将帮助我们确定错误的原因。 –

+0

欢迎来到Stack Overflow。我们将帮助您解决编程问题,但您首先希望自己动手,而您的问题不会显示。这个问题可能会被删除,因为脱离主题或不清楚。请阅读https://stackoverflow.com/help/how-to-ask以获取更多信息 – Mikkel

回答

1
-- Group by Come After Where Clause  
select Products.prodname, sum(billdetail.Qty) as qty,BillDetail.rate, 
     sum(billdetail.amt) as Amt from billdetail 
     inner join products 
     on products.prodid = billdetail.prodid 
     inner join category 
     on category.catid = products.catid 
     where CatName = 'Chicken' 
     group by prodname,rate