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

2011-07-02 Thread Black, Michael (IS)
That would 'splain it...I should have noticed... So we're left with this question... What's the problem with building the query that works? I don't see where you can't make it "column agnostic"...though perhaps there's another definition of that sprintf(sql,"select * from t where %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 *

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

2011-07-02 Thread Black, Michael (IS)
If you can build your SQL string with column_name exactly what is the problem with adding it a 2nd time? How do you build your SQL statement? And I get the same answer with either of your queries in 3.7.4 -- what version are you running and what answer are you getting? Are you saying that

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

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