Home  >  Article  >  Backend Development  >  求1sql语句的写法

求1sql语句的写法

WBOY
WBOYOriginal
2016-06-13 11:19:50881browse

求一sql语句的写法
我需要在留言表中查询最新的30条留言,然后这30条还要随机显示。


------解决方案--------------------
补充一下,就可以了
<br />select * from (SELECT * FROM xxx order by xxx desc limit 30) t order by rand() limit 5<br />


引用:
SQL可以做到,只是真心不高效
SQL code?1select * from (SELECT * FROM xxx order by xxx desc limit 30) t order by 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