On 20 Feb 2012, at 1:37am, Puneet Kishor <punk.k...@gmail.com> wrote:

> Say I have table like so
> 
>       CREATE TABLE t (
>               a1, a2, 
>               b1, b2, 
>               c1, c2
>       );
>       
> I want 
> 
>       a1 AS foo WHERE a1 != '' AND a2 != '' AND a1 = a2
>       
> from the remaining
> 
>       b1 AS foo WHERE b1 != '' AND b2 != '' AND b1 = b2
>       
> from the remaining
> 
>       c1 AS foo WHERE c1 != '' AND c2 != '' AND c1 = c2
>       
> from the remaining
> 
>       'none' AS foo

You can use CASE WHEN leaving your data as it is:

http://www.sqlite.org/lang_expr.html

But I suggest you also look at coalesce() on this page:

http://www.sqlite.org/lang_corefunc.html

since it might give you a simpler and faster function which might help if your 
app runs too slow.

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

Reply via email to