If function available? - Mailing list pgsql-novice

From Francisco Reyes
Subject If function available?
Date
Msg-id 20011120101503.V75685-100000@zoraida.natserv.net
Whole thread Raw
Responses Re: If function available?
List pgsql-novice
I am looking to do something like:

SELECT
Field1
, COUNT( IF( Field1 = 1, Field1, NULL ) ) AS one
, SUM( IF( Field1 = 2, Field1, NULL ) ) AS two
FROM
Table
GROUP BY
Field1

I tried it from the psql prompt and didn't work. Is there an IF or
IIF function that can be used on a select query?



pgsql-novice by date:

Previous
From: "Rob Arnold"
Date:
Subject: Re: 2 newbie questions
Next
From: Tom Lane
Date:
Subject: Re: Emergency backup question.