On Wed, Oct 12, 2011 at 11:28 AM, Simon Slavin <slav...@bigfraud.org> wrote:
> However, along the way ...
>
> sqlite> select a, case when b = 't' then 1 end, case when
>   ...> b = 'T' then 1 end from t;
> 1|1|
> 1|1|
> 1||1
> 2|1|
> 2||1
> 2||1
> sqlite> select a, case when b = 't' then 1 end, case when
>   ...> b = 'T' then 2 end from t;
> 1|1|
> 1|1|
> 1||2
> 2|1|
> 2||2
> 2||2
>
> Was that not what you were expecting ?  You are using count(2) not sum(2).

So? Number of non-NULL values in third column is 1 if first column is
equal 1 and 2 if first column is equal 2. And it doesn't matter
whether you use 1 inside case or 2. But results of select statement
show different numbers.


Pavel
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to