SELECT * FROM table WHERE
((field = value) AND
(field2 <> value2) AND
(field3 <> value3))
If you are dealing with NULL, you need to do two things:
- Use
SET ANSI_NULLS ON - Declare values
NULLfor a dummy value.
SQL Unable to compare zeros.
For this:
SET @value = ISNULL(@value, -1);
source
share