我试图让此查询从最高的qtyOrdered到最低的顺序进行排序,尽管当我运行它时,它却相反。结果是qtyOrdered从最低到最高运行。有什么帮助吗?
提前致谢!
这是我的SQL:
select Product.productId, Product.prodName, OrderedProduct.qtyOrdered, CustOrder.orderDate
from Product
join OrderedProduct
on Product.productId=OrderedProduct.productId
join CustOrder
on CustOrder.orderId=OrderedProduct.orderId
where qtyOrdered >= '50'
and orderDate between '2015-01-01' and '2015-01-31'
order by qtyOrdered;
最佳答案
您需要在DESC
之后添加qtyOrdered
,这意味着“降序”(从最高到最低)。对于“升序”,默认值为ASC
,从最低到最高。