select x.CategoryName '类别名称',y.ProductName '产品名称',sum(z.UnitPrice*Quantity) '产品销售额',
case when month(a.ShippedDate)<=3 and month(a.ShippedDate)>=1 then '1季度'
when month(a.ShippedDate)<=6 and month(a.ShippedDate)>=4 then '2季度'
when month(a.ShippedDate)<=9 and month(a.ShippedDate)>=7 then '3季度'
when month(a.ShippedDate)<=12 and month(a.ShippedDate)>=10 then '4季度'
end as '发货季度'
from Categories x,Products y,[Order Details] z,Orders a
where x.CategoryID=y.CategoryID and y.ProductID=z.ProductID and z.OrderID=a.OrderID and YEAR(a.OrderDate)=1997
group by y.ProductName,'发货季度'
结果报错:每个 GROUP BY 表达式必须至少包含一个不是外部引用的列。
求问怎么解决呀?