[sqlite] Re: - [sqlite] How to do NULL Handling in SELECT Statement?

2005-03-22 Thread rbundy

Try:

SELECT * FROM t1 WHERE b IS NULL;

A column value is null or not null; it cannot be said to equal null as null
has no value;

rayB



|-+--->
| |   Stefan Finzel   |
| |   <[EMAIL PROTECTED]|
| |   -Online.de> |
| |   |
| |   23/03/2005 04:20|
| |   Please respond to   |
| |   sqlite-users|
| |   |
|-+--->
  
>--|
  | 
 |
  |   To:   sqlite-users@sqlite.org 
 |
  |   cc:   
 |
  |   Subject:  - [sqlite] How to do NULL Handling in SELECT Statement? 
 |
  
>--|




Hi,

what is the correct way to query for NULL-values? I use  SQLite version
3.2.0

create table t1(a int, b char);
insert into t1 values(1, '2');
insert into t1 values(3,NULL);
insert into t1 values(NULL,'4');

select * from t1  where b=NULL;

-- this gives no result at all

select * from t1  where b='';

-- this also gives no result

select * from t1  where b<>'';

-- this gives the expected result (but i wanted the reverse data set)

1|2
|4

-- so i tried

select * from t1  where not b<>'';

-- and still i get not the result i was looking for.

TIA

Stefan







*** Confidentiality and Privilege Notice ***

This e-mail is intended only to be read or used by the addressee. It is
confidential and may contain legally privileged information. If you are not
the addressee indicated in this message (or responsible for delivery of the
message to such person), you may not copy or deliver this message to anyone,
and you should destroy this message and kindly notify the sender by reply
e-mail. Confidentiality and legal privilege are not waived or lost by reason
of mistaken delivery to you.

Qantas Airways Limited
ABN 16 009 661 901

Visit Qantas online at http://qantas.com





Re: [sqlite] How to do NULL Handling in SELECT Statement?

2005-03-22 Thread Marcel Strittmatter
what is the correct way to query for NULL-values? I use  SQLite 
version 3.2.0
try the following:
... WHERE field IS NULL;
or
... WHERE field IS NOT NULL;
Marcel


Re: [sqlite] How to do NULL Handling in SELECT Statement?

2005-03-22 Thread John LeSueur
Stefan Finzel wrote:
Hi,
what is the correct way to query for NULL-values? I use  SQLite 
version 3.2.0

create table t1(a int, b char);
insert into t1 values(1, '2');
insert into t1 values(3,NULL);
insert into t1 values(NULL,'4');
select * from t1  where b=NULL;
-- this gives no result at all
select * from t1  where b='';
-- this also gives no result
select * from t1  where b<>'';
-- this gives the expected result (but i wanted the reverse data set)
1|2
|4
-- so i tried
select * from t1  where not b<>'';
-- and still i get not the result i was looking for.
TIA
Stefan
select * from t1 where b is null
John


[sqlite] How to do NULL Handling in SELECT Statement?

2005-03-22 Thread Stefan Finzel
Hi,
what is the correct way to query for NULL-values? I use  SQLite version 
3.2.0

create table t1(a int, b char);
insert into t1 values(1, '2');
insert into t1 values(3,NULL);
insert into t1 values(NULL,'4');
select * from t1  where b=NULL;
-- this gives no result at all
select * from t1  where b='';
-- this also gives no result
select * from t1  where b<>'';
-- this gives the expected result (but i wanted the reverse data set)
1|2
|4
-- so i tried
select * from t1  where not b<>'';
-- and still i get not the result i was looking for.
TIA
Stefan