"Bruno Moreira Guedes"
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a query where I want to reuse a subquery result. By example:
>
> SELECT
>     CASE WHEN
>               (SELECT "value1") != ''
>     THEN
>               (SELECT "value1")
>      ELSE
>               (SELECT "value2")
>      END;
>
> But I don't want to repeat all the subquery again in the 'THEN'
> clause. Can I store the subquery result for using it again in the same
> query??

select case when a != '' then a else b end
from (select 'value1' a, 'value2' b);

Igor Tandetnik 



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

Reply via email to