随机取记录有关问题

随机取记录问题文章表从随机栏目下随机取几条符合条件的记录求高效写法数据库是mysql的,但是没人回答,到这

随机取记录问题
文章表
从随机栏目下随机取几条符合条件的记录
求高效写法


数据库是mysql的,但是没人回答,到这边试试

[解决办法]

SQL code
select a.* from `user` as awhere (select count(1) from `user`  where name >= a.name and id=a.id) <=2order by rand();