首页 >数据库 >mysql教程 >[转] mysql分组取每组前几条记要(排名)

[转] mysql分组取每组前几条记要(排名)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-07 16:27:211061浏览

[转] mysql分组取每组前几条记录(排名) ? ? ? ?参照这篇文章http://www.cnblogs.com/JulyZhang/archive/2011/02/12/1952213.html,拿出每个分类中的前几记录,写成的mysql如下: select a.id,name,type from adpos a where 3 (select count(*) from tablename

[转] mysql分组取每组前几条记录(排名)

? ? ? ?参照这篇文章http://www.cnblogs.com/JulyZhang/archive/2011/02/12/1952213.html,拿出每个分类中的前几记录,写成的mysql如下:

select a.id,name,type from adpos a where 3 > (select count(*) from tablename where type = a.type and id

? ? ? ?mysql居然不会支持top ,比如select top 3 id from table order by type,id,就不行。

? ?

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn