从Products表中检索所有的产品名称以及对应的销售总数

从 Products 表中检索所有的产品名称以及对应的销售总数

https://www.nowcoder.com/practice/2b289b78de1546f38fd24e17e56f1bec

select prod_name, (select sum(quantity) from OrderItems where prod_id = Products.prod_id) as quant_sold from Products;

想法:
通过子查询获取销售数量总数

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务