Wednesday, February 1, 2012

difference between <> any and not in


select *
from
(
select 'a' chr
union select 'b'
union select 'c'
union select 'd'
union select 'e'
) main

where main.chr not in ('a','b','c')

returns d,e

select *
from
(
select 'a' chr
union select 'b'
union select 'c'
union select 'd'
union select 'e'
) main

where main.chr <> any
 (
 select 'a' chr
union select 'b'
union select 'c'
 )
returns a,b,c,d,e and is nonsensical

No comments:

Post a Comment