mysql - How to order data randomly -


I have the following MySQL, I want to drag the data in random order.

Can I be taught in any way how can I please do it.

  $ Q = $ this-> Db- & gt; Query (include 'selection p. *, C. Et cattenam as F.P bytes; Category C at CID = Pc Series_id where c. Name = "front lom" and p.stats = "active") ;  

  $ Q = $ this- & gt; Db- & gt; Query ('Selection P *, C. Leave P as Products with At CATAIN C Cd = P C category_ID where c = name = "front lower" and p.state = "active" in order Rand ());  

You can use MySQL function to do this, note that it will actually perform slowly on a huge dataset (about ~ 10) in the MySQL table each The line will pick up a random number, so that the table can be large.

A safe way to do a SELECT count (*) from the FROM table and a random number to pick up and LIMIT 1 to pick up the nth line, Make a query with n if you only need 1, or it will not work if you do not get results in that order

If you really need a completely random set then It is in my opinion to do on the server side.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -