select * from table where tagid = any(select tagid from table group by tagid order by max(lastpost) desc limit 3)上面的语句报错 MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery我是mysql的新手, 请问我的写法有错误吗?

解决方案 »

  1.   

    select a.* from table a 
    inner join
    (select tagid from table group by tagid order by max(lastpost) desc limit 3) b
    on a.tagid = b.tagid
      

  2.   

    非常感谢, 可以查询成功, 请问这样写性能怎么样?
    在 MSSQL 里面用惯了 in, 这里用了 mysql 的语法 = any() 为什么还是不行呢, 你知道吗, 想了解多一点, 谢谢
      

  3.   

    参考下贴中的多种方法http://topic.csdn.net/u/20091231/16/2f268740-391e-40f2-a15e-f243b2c925ab.html
    [征集]分组取最大N条记录方法征集,及散分....