lundi 23 novembre 2020

RAND() is randomizing LEFT JOIN table

I have a query that generates a random user to display, it also displays where they are from. It is randomizing through the profiles perfectly EXCEPT it is also randomizing their location. How can I tell it to only randomize the profile, but still pull the info from the locations?

SELECT p.*, u.*, c.*, s.* FROM profiles as p
    LEFT JOIN users as u ON p.pro_user_id = u.user_id
LEFT JOIN countries AS c ON u.user_country = c.country_id
LEFT JOIN states AS s ON c.country_id=s.state_country_id
    WHERE pro_type = "Entertainer" AND pro_published = 1 ORDER BY RAND()



Aucun commentaire:

Enregistrer un commentaire