mdsk.net
当前位置:首页 >> mysql跨表查询,ORDER BY和GROUP BY,MAX相结合查... >>

mysql跨表查询,ORDER BY和GROUP BY,MAX相结合查...

SELECT max(m.id),m.send_id,m.receiver_id FROM messages AS m INNER JOIN users AS u ON (m.receiver_id=u.id AND m.receiver_id='3' ) GROUP BY m.id,m.sender_id,m.receiver_id ORDER BY m.id DESC LIMIT 0,10这样应该可以 你试试

网站首页 | 网站地图
All rights reserved Powered by www.mdsk.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com