我有两张桌子。
商品:
Table "public.sellers"
Column | Type | Modifiers
-----------------+--------------------------+---------------------------
sellers_id | character varying | not null
sellers_name | character varying | not null
卖家:
{{1}}
如何向卖家展示货物数量最多的请求? 谢谢。
答案 0 :(得分:1)
这是sql查询:
SELECT sellers.sellers_id
FROM goods JOIN sellers ON goods.goods_owner_id = sellers.sellers_id
GROUP BY sellers.sellers_id
ORDER BY COUNT(goods.goods_id) DESC
LIMIT 1