select * from table order by 优先字段1 asc , 普通字段2 limit 10
对于id name 1 苹果,梨,橙,柿 2 苹果,梨,橙 3 苹果,梨 4 苹果 5 select * from T where locate('苹果',name) order by length(name)-length(replace(name,',',''))得id name 4 苹果 3 苹果,梨 2 苹果,梨,橙 1 苹果,梨,橙,柿
mysql:SELECT * FROM table order by rand() limit 10; 从数据库随机取出来之后再用php处理一下,按照你的需求再排序咯
1 苹果,梨,橙,柿
2 苹果,梨,橙
3 苹果,梨
4 苹果
5
select * from T where locate('苹果',name) order by length(name)-length(replace(name,',',''))得id name
4 苹果
3 苹果,梨
2 苹果,梨,橙
1 苹果,梨,橙,柿