记录一次mysql的三表关联查询

2019年4月10日14:08:00 发表评论 105 次浏览

根据用户分组查出用户的发言次数和对应的绑定账号信息

select
count(chat.chat_content) as times,
chat.created_at,user_relation.transaction_account,user_im_info.imcounselor
from chat left
join user_relation on user_relation.user_id = chat.user_id
left join user_im_info on chat.user_id = user_im_info.user_id
where chat.created_at > 1554739200  and  chat.created_at < 1554825599
group by chat.user_id;
阿修罗

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: