求大神告知,查看订单详细表和产品表,但是总数和价格无法用group by 显示,怎么解决

jike_0263810 Microsoft SQL S... 最后由 jike_0263810 于2016年10月09日回复

  • 2 解决
  • 1.8k 浏览

select a1.ProductName 产品名称 ,COUNT(a1.ProductName) as shuliang,SUM(shuliang*a1.UnitPrice) from [Order Details] a2 left join  Products a1

on a1.ProductID=a2.ProductID

group by ProductName

select * from [Order Details]

select * from Products