tags:

views:

31

answers:

2
+1  Q: 

Left Join Issue

Hi,

Am trying to do a left join along with a condition. Say this is my table:

a     b     c
-------------------------
1     1     NULL
3     3     something

and my query is

select * from x left join y on x.a = y.b

The problem is that I don't want c to be "something" so when i add

select * from x left join y on x.a = y.b where y.c <> 'something'

it displays 0 rows. it should actually display

a     b     c
-------------------------
1     1     NULL
+2  A: 

I think you ment:


SELECT *
FROM x
LEFT JOIN y ON x.a = y.b
WHERE y.c <> 'something'
rockacola
yes, sorry fixed it
Alec Smart
+1  A: 
select * 
from x left join y on x.a = y.b 
WHERE y.c IS NULL OR y.c <> 'something'
tster