At 4:42 PM -0500 9/4/01, Islam, Sharif wrote:
>I have this two table.
>ID Name Phone someother fileds....
>1 Bob 1234
>2 Joe 5678
>3 Mary 5678
>4 John 6789
>ID Name Email
>1 Bob bob@stripped
>2 Joe blough@stripped
>3 John john@
>the query :
>select t1.Name, t1.Phone , t2.Email from t1,t2 where t1.name=t2.name works
>But I want to display all the names. Table2 doesn't have all the names, so
>for example mary is missing , because she doesn't have email address. I want
>to display all the info about everyone, regardless if they have email
>address or not. Is that make sense? Any hint.
Use a LEFT JOIN to force the output to contain a row for every record
in t1, whether or not t2 contains a match:
select t1.Name, t1.Phone , t2.Email from t1 LEFT JOIN t2 ON t1.name=t2.name
The value of t2.Email for t1 rows with no match in t2 will be NULL.
Paul DuBois, paul@stripped