Re: How can i get all names where field2 is not equal to 'x'
- From: "Bart" <b@xxx>
- Date: Tue, 12 Feb 2008 20:56:43 +0100
Thanks
"Russell Fields" <russellfields@xxxxxxxxxx> schreef in bericht
news:%23LZdaCYbIHA.4144@xxxxxxxxxxxxxxxxxxxxxxx
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
.
- References:
- How can i get all names where field2 is not equal to 'x'
- From: Bart
- Re: How can i get all names where field2 is not equal to 'x'
- From: Russell Fields
- How can i get all names where field2 is not equal to 'x'
- Prev by Date: Re: ADO (VB6 to SQLExpress2005
- Next by Date: Timeout problem when connecting from Vista clients to SQL Server
- Previous by thread: Re: How can i get all names where field2 is not equal to 'x'
- Next by thread: Timeout problem when connecting from Vista clients to SQL Server
- Index(es):
Relevant Pages
|
Loading