mardi 27 janvier 2015

Mysql join tables Randomly

I have two tables. (say TableA and TableB)

TableA have 10 rows and TableB have 50 rows.

I want each row in TableA should be joined with X number of rows from TableB randomly, so that i get 500 unique results


For example if TableA has rows (a,b,c) and TableB have rows (p,q,r,s,t,u) and X=2 ,then expected result is:



a-p
a-q
b-r
b-s
c-t
c-u


This joining should be random





Aucun commentaire:

Enregistrer un commentaire