02-13-2008, 03:55 AM
|
#4 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Posts: 154
Thanks: 31
|
So we're assuming the relation between the two tables is members.id ==> info.user_id? You might consider using `member_id` as the column name on both columns, it looks a bit ambiguous. I usually use naming conventions like members.memberID ==> info.memberID_FK to relate the two tables and make it clear the info table stores the Foreign Key.
Code:
SELECT
m.username
, m.password
, i.info1
, i.info2
FROM members AS m
INNER JOIN info AS i
ON ( m.id = i.user_id )
WHERE m.id = 2;
I'd be happy to provide a 'real' JOIN with the CONCAT expression if you'd provide more detail on the columns and what output you expect.
Please post any questions you have as to the JOIN statement itself.
__________________
I reject your reality, and substitute my own.
|
|
|
|