First, this really isn't a Perl question but I'm answering it nonetheless since SQL questions are so pertinent to what many of us do. I often ask off-topic questions, but I usually preface them with an "(OT)" so that monks who wish to avoid them can do so.
Having said that, I'm confused as to your question. I don't know why you want a temp table. I don't use MySQL, but a quick scan of the documentation suggests that it does allow joins. Assuming that your first table is named 'winners' and the second is named 'losers', the syntax, according to the docs, would be similar to the following:
SELECT w.match_id, w.winner_name, l.loser_name FROM winners AS w, losers AS l WHERE w.match_id = l.match_id
I'm also a bit confused as to why winners and losers are in separate tables. Aren't both dependant on the match_id? Of course, since I don't know your needs, I could be way off base there.
Last comment: if users of your game are completely anonymous, there's really no point in storing an arbitrary winner or loser names in the database. However, if they register, it's good to put them into a user table with a non-identifying key and have that key in your other tables. For example, if "Red Mustang" is spread out over seven or eight tables and this user decides that /s?he/ wants to be renamed "Red Lightning", you either say "no" or you search through the database for all instances of "Red Mustang", hope you don't miss any, and change them. However, if "Red Mustang" is actually user 17, you just need to change the name in the user table and all SQL automatically picks up the change. Much nicer that way.
Again, I don't use MySQL, so this advice may be totally off base.
Cheers,
Ovid
Update: Looks like Kanji has a better answer. I totally misread princepawn's post :)
Vote for paco!
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to (Ovid) Re: MySQL join of join?
by Ovid
in thread MySQL join of join?
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |