goqu
goqu copied to clipboard
window function postgres filter
Hi great author:) Dialect
- [ ] postgres how make filter for this window function?, for example SUM(adi.amount) FILTER (WHERE ad.document_status = 'pending') as unpaid_document_sum
Thanks Ales
You could put the whole thing in a literal
db.From("x").Select(goqu.L(`SUM(adi.amount) FILTER (WHERE ad.document_status='pending')`)).As("unpaid_document_sum")
SELECT SUM(adi.amount) FILTER (WHERE ad.document_status='pending')
FROM "x"