mattblack_uk
05-02-2007, 02:58 PM
I'm quite new to MySQL and struggling with a MySQL SELECT Statement.
I'm working with 3 tables which are as follows:
Table 1
User ID
Username
Table 2
Message ID
Author ID (linked to 1.User ID)
Subject
Message Text
Table 3
Message ID
Author ID
Reciever ID
These are obviously not the complete tables however they will suffice to explain my problem. I should let you know that I have to work with these and cannot amend them in any way.
I would like to do a SELECT that will give me the author username, reciever username, subject, and text
however according to my limited knowledge, this would work out as follows:
SELECT Table1.username, Table1.username, Table1.subject etc....
So my question is how can I tell MySQL what to associate with each instance of username?
I'm working with 3 tables which are as follows:
Table 1
User ID
Username
Table 2
Message ID
Author ID (linked to 1.User ID)
Subject
Message Text
Table 3
Message ID
Author ID
Reciever ID
These are obviously not the complete tables however they will suffice to explain my problem. I should let you know that I have to work with these and cannot amend them in any way.
I would like to do a SELECT that will give me the author username, reciever username, subject, and text
however according to my limited knowledge, this would work out as follows:
SELECT Table1.username, Table1.username, Table1.subject etc....
So my question is how can I tell MySQL what to associate with each instance of username?