thats exactly what i wanted - the perfekt solution, now i have to thing about performance
but thanks to Shawn Green for trying to help :> ""Arnaud"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > > i have lets say 1000 different fruits > > and 1000 different animals > > with many to man relations > > now i want to extract 100 differnt fruits held by 100 different > > animals without dupes of fruit or animal > > That's a nice one ! I'll give it a try : > The point is to get 100 random couples of (id_fruits, id_animals), > with unique id_fruits and unique id_animals, right ? > > SELECT id_fruits AS my_id_fruits, > (SELECT id_animals > FROM fruits_animals > WHERE id_fruits = my_id_fruits > ORDER BY RAND() > LIMIT 1) AS my_id_animals > FROM fruits_animals > GROUP BY my_id_fruits > ORDER BY RAND() > LIMIT 100; > > You have your unique many-to-many relations' table, you just have to > join this with the animals and fruits tables. > > Regards, > Arnaud -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]