doug-martin / goqu

SQL builder and query library for golang
http://doug-martin.github.io/goqu/
MIT License
2.38k stars 206 forks source link

window function postgres filter #198

Open talpa opened 4 years ago

talpa commented 4 years ago

Hi great author:) Dialect

Thanks Ales

Frug commented 3 years ago

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"