querybuilder
querybuilder copied to clipboard
`FILTER` clause in `SELECT` clause
In SQL we can add a FILTER
clause to an aggregate SELECT
clause, i.e.
SELECT [item], SUM([price]) AS [total], SUM([price]) FILTER ( WHERE [date] >= '2021-01-01' ) AS [sales2020]
FROM [orders]
GROUP BY [item]
It would be a huge help if SqlKata can support passing WHERE
clauses with their bindings to a SELECT
clause.
WhereRaw? Can you not do it with that?
WhereRaw
works on the overall query level, I am referring to the FILTER
clause available on aggregate expressions.
postgres docs
Support added will be available in the next release