Обсуждение: select and null

Поиск
Список
Период
Сортировка

select and null

От
Peter Pilsl
Дата:
I have a table and want to print out all entries that are not Null ...

select * from test;
 entry
-------
 1
 2
 3

(4 rows)

select * from test where entry=Null;
 entry
-------

(1 row)

select * from test where entry<>Null;
 entry
-------
(0 rows)


select * from test except select * from test where entry=Null;
 entry
-------
(0 rows)


What is my brain missing here ???

thanks,
peter


--
mag. peter pilsl
email: pilsl@goldfisch.at
pgp-key available

Re: select and null

От
Marko Kreen
Дата:
On Fri, Oct 27, 2000 at 02:17:23PM +0200, Peter Pilsl wrote:
> I have a table and want to print out all entries that are not Null ...
>
> select * from test where entry=Null;

xxx = NULL -> answer is NULL, ofcourse.

You whould do ' ... WHERE entry IS NULL'


--
marko


Re: select and null

От
Igor Roboul
Дата:
On Fri, Oct 27, 2000 at 02:17:23PM +0200, Peter Pilsl wrote:
> select * from test where entry=Null;

select * from test where entry is not NULL;

or

select * from test where entry is NULL;


--
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga",
Sochi, Russia
http://www.brainbench.com/transcript.jsp?pid=304744

Re: select and null

От
"Len Morgan"
Дата:
select * from test where entry NOT NULL ;

:-)
-----Original Message-----
From: Peter Pilsl <pilsl@goldfisch.at>
To: postgres mailinglist <pgsql-general@postgresql.org>
Date: Friday, October 27, 2000 7:41 AM
Subject: [GENERAL] select and null


>I have a table and want to print out all entries that are not Null ...
>
>select * from test;
> entry
>-------
> 1
> 2
> 3
>
>(4 rows)
>
>select * from test where entry=Null;
> entry
>-------
>
>(1 row)
>
>select * from test where entry<>Null;
> entry
>-------
>(0 rows)
>
>
>select * from test except select * from test where entry=Null;
> entry
>-------
>(0 rows)
>
>
>What is my brain missing here ???
>
>thanks,
>peter
>
>
>--
>mag. peter pilsl
>email: pilsl@goldfisch.at
>pgp-key available
>