审阅表有store\u idx、user\u idx等。。。
我想创建一个查询语句,该语句获取有关用户用输入的userid值作为书签的商店的信息。
我的疑问句是
select A.store_name
, A.store_img
, count(B.store_idx) as review_cnt
from board.store A
Left
Join board.review B
On A.store_idx is B.store_idx
where store_idx is (select A.store_idx from bookmark where user_id = ?)
然而,结果什么也没有出来。
帮助我。。
2条答案
按热度按时间0ve6wy6x1#
请使用以下查询:
uyhoqukh2#
这个
WHERE
子句显然正在过滤掉所有行。对此我们无能为力。但你的查询也缺少一个GROUP BY
,可以改进表别名,并且join
情况不正确。所以,试试这个版本: