Bluehost.com Web Hosting $6.95

randomly join two tables (not Cartesian)

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2007
lskatz
 
Posts: n/a
Default randomly join two tables (not Cartesian)

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:31 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0