Home  >  Article  >  Database  >  sql 随机取得数据

sql 随机取得数据

WBOY
WBOYOriginal
2016-06-07 17:46:35813browse

以前没注意到随机抽取数据,下面我来说说我的经验.

mssql :

select * from tablename order by newid() desc

在mssql取得随便数据的函数是newid

mysql中:

select * from tablename order by rand() desc

在mysql用来取得随便数据的函数是rand了.

就这么简单,

申明:转载请注来处.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn