On 10/3/07, Jimmy Choi <[EMAIL PROTECTED]> wrote:
> I expect to get the following result set:
>
> metric_type | result
> ------------+-------
>     0       |   2
>     1       |   3

Try:

SELECT   metric_type
       , SUM(CASE metric_type
               WHEN 0
                 THEN 1 / val
               WHEN 1
                 THEN val
             END) AS RESULT
    FROM metrics
GROUP BY metric_type
ORDER BY metric_type

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to