Re: IN vs EXIIST - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Re: IN vs EXIIST
Date
Msg-id 3D89B68B.1020900@mega-bucks.co.jp
Whole thread Raw
In response to IN vs EXIIST  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Responses Re: IN vs EXIIST
List pgsql-general
Jochem van Dieten wrote:
 >
 > SELECT     key1, Min(CASE WHEN x THEN 1 ELSE 0 END) AS isTrue
 > FROM       table
 > GROUP BY   key1
 > HAVING     isTrue = 1

I tried this but got an error:

psql TMP -c "select invoice_id, min(case when received then 1 else 0
end) as ok from invoice_li group by invoice_id having ok = 1"

ERROR:  Attribute 'ok' not found

Jc




pgsql-general by date:

Previous
From: Joel Palmius
Date:
Subject: "Custom" records?
Next
From: Jochem van Dieten
Date:
Subject: Re: IN vs EXIIST