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)
 RE: SQL Query with a Join!!

Author  Topic 

agarwasa2008
Posting Yak Master

109 Posts

Posted - 2009-08-19 : 18:23:02
Does this query look correct. I need to check against a "SINGLE" id value for example '45KLGDJL34' which in my code will be a user entered value. Do I need the "ON" clause here for a single id check.

Thanks!!


Here's the code
================
select *
from dbo.table1 b
Left Outer Join dbo.table2 a
on b.id = a.id
where a.id = '45KLGDJL34'



SA

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-20 : 00:14:37
if u want the records from both tables table1 & table2 then u can have left join if value is exists in the table2 it will display or display null values in the respective columns
Go to Top of Page

agarwasa2008
Posting Yak Master

109 Posts

Posted - 2009-08-20 : 11:47:45
Thanks bklr!!

SA
Go to Top of Page
   

- Advertisement -