Heim  >  Artikel  >  Backend-Entwicklung  >  求1sql语句的写法

求1sql语句的写法

WBOY
WBOYOriginal
2016-06-13 12:49:43725Durchsuche

求一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()
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn