All Forums UDA
AB75151 20 posts Joined 06/09
22 Dec 2009
Difference between NOT and NOT IN

Can you please help me with the difference between below queries.Sel * from TABLEwhere NOT (NAME= 'L'AND ID= '123')Sel * from TABLEwhere (NAME<> 'L'AND ID<> '123')I assumed that both should work in the same way.. But I observe that they dnt give me the same output. I am not sure how this works.Thanks!Prajith

pawan0608 101 posts Joined 12/07
22 Dec 2009

This is incorrect according to Boolean Theory, both or not equivalent logically. The correct equivalent of original stmt would beSel * from TABLEwhere (NAME <> 'L' OR ID <> '123')Please refer any basic computer science book to refresh your memory :)

29 Dec 2009

how can you expect the same output you have used '=' operator and in the other query '<>'Funny!!!!!!!!!!!!!Guru is correct

You must sign in to leave a comment.