这是SQL,但它给了我一个错误:
select u.productId, count(ProductID) as total, p.Name
from dbo.UserXProduct AS u
INNER JOIN dbo.product AS p ON u.ProductID = p.ID
group by productid, p.name
having count(ProductID) > 5
order by u.dateEntered desc, total desc
编辑:这是我得到的错误:
列“dbo.UserXProduct.DateEntered”在 ORDER BY 子句中无效,因为它不包含在聚合函数或 GROUP BY 子句中