使用mySQL选择至少有一个或多个订单的所有用户
SELECT users.id, COUNT(?) FROM orders
INNER JOIN users ON (orders.user_id = users.id)
WHERE ??
我怎样才能输出:
UserID: 123 has made 22 orders
UserID: 124 has made 2 orders
等等?
我想只抓取有一个或多个订单的用户,并排除那些有 0 个订单的用户。
SELECT users.id, COUNT(?) FROM orders
INNER JOIN users ON (orders.user_id = users.id)
WHERE ??
How can i output:
UserID: 123 has made 22 orders
UserID: 124 has made 2 orders
and so on?
I would like to only grab the users that has one or more orders, and exclude those with 0 orders.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)