I have the following query for MySQL
SELECT * FROM thetable ORDER BY RAND() LIMIT 0,3
Will this return 3 randomly selected rows or will it select the first 3 rows and then order them randomly?
I have 2 tables with the following structure
product
- id
- companyid
- description
company
-id
-name
-location
Now I want to select 3 random products and display the product id, product description, company name, and comany location.
Will the following code work? Or is there a better way to do it?
SELECT p.id,p.description,c.name,c.location FROM product p, company c WHERE p.companyid=c.id ORDER BY RAND() LIMIT 0,3
Thanks
d.