Re: How can i get all names where field2 is not equal to 'x'
- From: "Russell Fields" <russellfields@xxxxxxxxxx>
- Date: Tue, 12 Feb 2008 09:07:27 -0500
Bart,
I am afraid that you have to care about NULLs, since they don't compare as
equal or unequal. So...
-- Test for the NULL explicitly
select name from mytable where not (field2='x') or field2 IS NULL
-- Turn the NULL into a zero length character string that can be compared to
a string
select name from mytable where COALESCE(field2,'') <> 'x'
RLF
"Bart" <b@xxx> wrote in message
news:%23oX$8XVbIHA.4712@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
How can i get all names where field2 is not equal to 'x'?
I did this: select name from mytable where not (field2='x')
result: only joe is fetched
this is the table:
name field2
------ -----
bob x
joe
john NULL
Thanks
Bart
.
- Follow-Ups:
- References:
- Prev by Date: How can i get all names where field2 is not equal to 'x'
- Next by Date: Re: ADO (VB6 to SQLExpress2005
- Previous by thread: How can i get all names where field2 is not equal to 'x'
- Next by thread: Re: How can i get all names where field2 is not equal to 'x'
- Index(es):
Relevant Pages
|
Loading