NOT IN question

G

Guy Dillen

I have a table person with e.g. the following columns:
name, firstName, status

the status field is a 1 char textfield.

now when i launch the query:

select * from person where status NOT IN ('A', 'B, 'C')

the query EXCLUDES the records/rows that have A, B or C in their status
column BUT also de records/rows that have a blank ' ' in their status
column!

Anyone has an idea why this happens?

Thanks,

Guy
 
G

Guy Dillen

Thanks John.


John Spencer (MVP) said:
Because the Status field does not contain an empty string, but contains NULL
which never matches anything.

Try
SELECT *
FROM Person
WHERE Status Is Not Null OR Status Not In ('A','B, 'C')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top