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