Chinaunix

标题: mysql中取随机n条记录 [打印本页]

作者: leejianzhou    时间: 2006-05-31 09:35
标题: mysql中取随机n条记录
[color="#02368d"]mysql中取随机n条记录
取随机n条记录
mysql: select * from tablename order by rand() limit 10
sqlserver: select top 10 * from tablename order by NEWID()
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/5737/showart_120759.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2