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)
 INNER JOIN and NULL Value

Author  Topic 

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2011-08-12 : 07:49:00

I have a simple select statement that works fine unless the value in the joined table is NULL

SELECT a.Col1, a.Col2, b.join1, b.join2
FROM tbl1 a
INNER JOIN jnTbl b ON b.dist = a.dist
Where a.ID = @param

Now, b.dist may be NULL and it that's the case, nothing is returned.
But I need the rest of the values.

I have tried adding in the JOIN OR b.dist IS NULL but that won't work.

Any suggestions?

Thanks.

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2011-08-12 : 07:52:09
Ok, I got it.

A LEFT OUT JOIN did it.
Sometimes I forget sql LOL......
Go to Top of Page
   

- Advertisement -