I have Table A with 15,000 rows each having a unique ID and Table B with 10,000,000 rows with multiple rows for each unique ID in Table A. I need to check Table B for each ID from Table A and select 1 random row from each of all matching IDs. So once the query runs I will end up with 15,000 random rows from Table B (each with a unique Table A ID).
I'd assume this is too intense for RAND() alone or a loop so it's got to be an involved select.
Looked to this but it only involves one table http://explainextended.com/2009/03/01/selecting-random-rows/
Not able to adjust it to do what I need.