比如说我要在test表里提取5条记录,order by rand() limit 0,5
table表是
id
1
2
3
4
5
6
7
一般情况下提示的5条是不重复的5条记录,如何让它有可能重复呢?
比如说我获得的数据集是
1,1,2,3,5
1,2,2,3,3
5,6,6,6,7请教了~~:)
table表是
id
1
2
3
4
5
6
7
一般情况下提示的5条是不重复的5条记录,如何让它有可能重复呢?
比如说我获得的数据集是
1,1,2,3,5
1,2,2,3,3
5,6,6,6,7请教了~~:)
union all
(select * from test order by rand() limit 1)
union all
(select * from test order by rand() limit 1)
union all
(select * from test order by rand() limit 1)
union all
(select * from test order by rand() limit 1);
不知道哪一天,你的系统负载就会疯狂上升!
绝对赞同[/Quote]建议用4楼的方法。