sql随机抽取数据
mysql: select * from tablename order by rand() limit 10
sqlserver: select top 10 * from tablename order by NEWID()
select ts_name from 表名 as t1 JOIN (RAND()*((select MAX(t_id) FROM 表名)-(select MIN(t_id) from 表名))+(select MIN(t_id) from 表名) as id) as t2
where t1.t_id
>=t2.t_id ORDER BY t1.id LIMIT 1
来自:http://bbs.blueidea.com/thread-359132-1-1.html