Page 1 of 1

extract from 2 tables but have missing data

Posted: Thu May 20, 2004 5:02 pm
by juls
Hi,

should be easy...but battling.

I want to print the data from two mysql tables in a html table. I want to print everything from table_1 (username and nickname). And if I have their email address in table_2, I want to print that in the same row in the html table. The two tables have the common field userID. But table_2 does not have email addresses for all users. This is where I'm having problems.

I am able to either print the info for users who's email address are in table_2, or I end up printing duplicates of users in table_1.

How can I neatly print the user info and their email address when it is present?

Posted: Thu May 20, 2004 7:27 pm
by lostboy
use an outer join for the sql statement and make the combined recordset one line for each user


show your code

Posted: Fri May 21, 2004 1:38 am
by juls
Thanks, lostboy. I did some research on outer joins and it works!