Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Join Help

Status
Not open for further replies.

robman70

Technical User
Aug 6, 2002
90
I need help yet again :)

My sql statement has an inner join:
Code:
select table1.name, table2.user, table3.dest from table1 INNER JOIN table2 on table2.user = table1.uname INNER JOIN table3 on table3.dest = table1.destid

what i want to know is how can i say that sometimes table2.user will be null and if it is just match the other two conditions and return null for table2.user. I hope im being clear i know it may sound a little confusing. i tried:
Code:
select table1.name, table2.user, table3.dest from table1 INNER JOIN table2 on table2.user = table1.uname or is null table2.user INNER JOIN table3 on table3.dest = table1.destid
but it didnt like that

any help appreciated
 
Take a look at the "Outer" style of join. It's used when one of the tables might not have a value, but you want the matching row anyway.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top