Search Postgresql Archives

Evaluate only one CASE WHEN in a select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everybody,

I'm implementing something like this:

SELECT
    CASE WHEN add_numbers(t1.main_number,t2.main_number)>100
        THEN t1.description1
        ELSE t2.description1
    END AS number_description1,
    CASE WHEN add_numbers(t1.main_number,t2.main_number)>100
        THEN t1.description2
        ELSE t2.description2
    END AS number_description2
FROM table1 t1, table2 t2;

Is there a way to evaluate the 'CASE WHEN' only once?

Thanks

Daniel



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux