PostgreSQL
 sql >> Base de Dados >  >> RDS >> PostgreSQL

Vários casos quando está com saída na mesma linha

select
    min(purchaseDate) filter (where fruitType = 'apple') as apple,
    min(purchaseDate) filter (where fruitType = 'orange') as orange,
    customer
from fruitPurchases
group by customer