Riparian Posted July 8, 2012 Share Posted July 8, 2012 I have a table with 2000+ entries with a considerable amount of data per record. This one table is created from a number of other tables using ....(cut to the bone) mysql_query("Drop Table IF EXISTS THETABLE "); mysql_query("Create Table IF NOT EXISTS THETABLE select * from table1 where table1.in_stock='T' "); mysql_query("INSERT INTO $DATA.`THETABLE ` SELECT * FROM $DATA.`table2`"); mysql_query("INSERT INTO $DATA.`THETABLE ` SELECT * FROM $DATA.`table3`"); etc etc The new table is in sequential order as read from the other tables and inserted into THETABLE. What I would like to do is random sort the contents and then recreate THETABLE in that random order . Any help is greatly appreciated. p.s. Random sorting the table at display time is no good for me as paging through using order by rand() shows duplicates so I think it will be easier and quicker to display without sorting . Quote Link to comment Share on other sites More sharing options...
Barand Posted July 9, 2012 Share Posted July 9, 2012 CREATE secondtable SELECT * FROM thetable ORDER BY RAND(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.