I have a table lets call it moms
each row in the moms table can have many kids, so for that I have a kid table and I have a mxk map table to relate them.
what I want to do is select all the moms and for each mom I want a random kid to go with it.
Something like
SELECT moms.m_id,m_name,kids.k_id,k_name FROM
moms, mxk, kids WHERE
moms.m_id = mxk.m_id
AND mxk.k_id = kids.k_id
GROUP BY moms.m_id
This gives me the same kid for each mom each time. if I say ORDER by RAND() at the end, it just puts the moms in random order. I want to randomly order the kids THEN do the group by but that's a syntax error.
How can I do this? thanks