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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.