限时免费试用:欢迎注册 api.bigmodel.org ,快速体验大模型 API 接入服务。

Mysql

查询一个表的id 并统计在另一个表出现的次数

select p.title,p.pic,p.id,p.author, p.time,p.is_ok,count(pz.post_id) c FROM pre_post p,pre_post_zan pz WHERE pz.post_id = p.id and pz.zan=1 group by(pz.post_id) ORDER BY c desc 注:

作者
王明昌
发布时间
select p.title,p.pic,p.id,p.author, p.time,p.is_ok,count(pz.post_id) c
FROM  pre_post p,pre_post_zan pz
WHERE pz.post_id = p.id and pz.zan=1 
group by(pz.post_id) 
ORDER BY c desc
注: ORDER BY c desc
0/500
友善分享您的看法。
反馈邮箱