标签:
1. 同一属性的多值过滤
2. 如何在子查询中匹配两个值
准备数据
user1表
user_kills
join方法
select a.user_name, b.timestr, b.kills from user1 a join user_kills b on a.id = b.user_id join (select user_id,max(kills) as cnt from user_kills group by user_id) c on b.user_id = c.user_id and b.kills = c.cnt
where子句方法
select a.user_name, b.timestr, b.kills from user1 a join user_kills b on a.id = b.user_id where (b.user_id,b.kills) in (select user_id,max(kills) as cnt from user_kills group by user_id);
标签:
原文地址:http://www.cnblogs.com/phpfans/p/4657088.html