Mysql random rows from all values of another table -
i have table 15,000 rows each having unique id , table b 10,000,000 rows multiple rows each unique id in table a. need check table b each id table , select 1 random row each of matching ids. once query runs end 15,000 random rows table b (each unique table id).
i'd assume intense rand() alone or loop it's got involved select.
looked involves 1 table http://explainextended.com/2009/03/01/selecting-random-rows/
not able adjust need.
what this?
select distinct b.a_id b inner join on a.id = b.id order rand(10000000)
Comments
Post a Comment