Re: [sqlite] How to search for multiple values in a column including null without repeating column name ?

2011-07-02 Thread Black, Michael (IS)
sqlite.org] on behalf of Jean-Christophe Deschamps [j...@antichoc.net] Sent: Saturday, July 02, 2011 8:01 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] How to search for multiple values in a column including null without repeating column name ? Michael, >Are you s

Re: [sqlite] How to search for multiple values in a column including null without repeating column name ?

2011-07-02 Thread Jean-Christophe Deschamps
Michael, >Are you saying that "1" below doesn't show up in the first query result? > >sqlite> create table t(i int,name string); >sqlite> insert into t values(1,NULL); >sqlite> insert into t values(2,'two'); >sqlite> select * from t where i in (1,2,3,null); >i|name >1| >2|two >sqlite> select * fro

Re: [sqlite] How to search for multiple values in a column including null without repeating column name ?

2011-07-02 Thread Black, Michael (IS)
lite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of yogibabu [madra...@interia.pl] Sent: Saturday, July 02, 2011 3:21 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] How to search for multiple values in a column including null without repeating column name ? cons

Re: [sqlite] How to search for multiple values in a column including null without repeating column name ?

2011-07-02 Thread Igor Tandetnik
Vitali Kiruta wrote: > If you know for sure column_name won't contain a certain value, for > example -1, you could do something like this. > > select * from table_name where coalesce(column_name, -1) in (1,2,3,-1); And if you don't, you can just pick one of the values already in the list: selec

Re: [sqlite] How to search for multiple values in a column including null without repeating column name ?

2011-07-02 Thread Vitali Kiruta
If you know for sure column_name won't contain a certain value, for example -1, you could do something like this. select * from table_name where coalesce(column_name, -1) in (1,2,3,-1); On 2 July 2011 10:21, yogibabu wrote: > > consider this: >  SELECT * FROM table_name WHERE column_name in(1,2

[sqlite] How to search for multiple values in a column including null without repeating column name ?

2011-07-02 Thread yogibabu
consider this: SELECT * FROM table_name WHERE column_name in(1,2,3) or column_name is NULL Here column name is referenced two times. Putting it this way: SELECT * FROM table_name WHERE column_name in(1,2,3,null) causes that in() ignores null value without giving any error. I need to add l