samedi 26 septembre 2015

How to randomize the sql result set from a two tables?

I have two tables

Table1 person:
-person_id
-name

Table2 expertise:
-expertise_id
-person_id
-expertise_name

What I want to achieve is to return 5 random persons with a corresponding 2 random expertise of that person. So far I can return all the persons and all their expertise.

SELECT * FROM person p, expertise e WHERE e.person_id = p.person_id

Can anyone help me on this? Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire