Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 basic table join problem

Author  Topic 

matthisco
Starting Member

48 Posts

Posted - 2009-10-13 : 06:27:08
Hi Folks,

I have a basic sql statment that only returns results that exists in the delcinereason table also.

Select * from clinics
INNER JOIN declinereason ON clinics.reason = declinereason.id
order by name

Can anyone please tell me how I can show all the rows in the clinics table, and data from the declinereason if it exists?

Thanks in advance

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-10-13 : 06:29:09
Select * from clinics
LEFT JOIN declinereason ON clinics.reason = declinereason.id
order by name
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-10-13 : 06:58:23
go through this link
http://www.sqlteam.com/article/writing-outer-joins-in-t-sql
Go to Top of Page

matthisco
Starting Member

48 Posts

Posted - 2009-10-14 : 04:29:57
Many thanks
Go to Top of Page
   

- Advertisement -