I am quite new with MySQL, but I have a table named Contacts
with ContactID
and ContactName
So let's say I have 100 Contacts
. For each contact I want a random set of 3 from the n-1
rest records but have this set of 3 as columns in order to display a query of 100 records with 3 columns of random Contacts,
Is it possible?
thank you
Try this..
SELECT * FROM table_name ORDER BY RAND() LIMIT 3;