querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

`FILTER` clause in `SELECT` clause

Open yankyhgoflow opened this issue 2 years ago • 2 comments

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.

yankyhgoflow avatar Jul 06 '21 20:07 yankyhgoflow

WhereRaw? Can you not do it with that?

generik0 avatar Jan 29 '22 07:01 generik0

WhereRaw works on the overall query level, I am referring to the FILTER clause available on aggregate expressions. postgres docs

yankyhgoflow avatar Feb 01 '22 20:02 yankyhgoflow

Support added will be available in the next release

ahmad-moussawi avatar Oct 01 '22 06:10 ahmad-moussawi