This is a discussion on randomly join two tables (not Cartesian) within the MySQL Database forums, part of the Database Forums category; Hi, I have one table but would like to double the information in it randomly. I know that I can ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi, I have one table but would like to double the information in it
randomly. I know that I can randomize the tables by an order by rand() clause. However, how can I arbitrarily join them without a condition, without a Cartesian product? The only condition would be that row 1 joins with row 1, row 2 with row 2.... but only after they've been randomized. Thus, all data is used exactly one time per table and twice in the derived table. Thanks! For instance if my table is this: id name 1 Sarah 2 Louis 3 Bobby Then I want my statement to give me this: id name id name 1 Sarah 2 Louis 2 Louis 3 Bobby 3 Bobby 1 Sarah |