欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

sqlite 获取用户消息列表多表查询语句

程序员文章站 2022-05-15 23:45:50
...
很少写多表查询的语句,请教宏利得到的



select m.msg as msg_content, m.type as msg_type, m.time as msg_time, m.state as msg_state, m.has_read as has_read, u.id as friend_user_id,u.name as friend_user_name,u.avatar as friend_user_avatar from message as m, user as u where m.user_id = ? and m.friend_user_id = u.id group by m.friend_user_id order by m.time desc

相关标签: sqlite