Closed ahmad-moussawi closed 1 year ago
👍 Thanks, this is really taking this library to the next level!
Thanks @ahmad-moussawi you rock!
Missing alias for this feature
@kenzouno1 what do you mean exactly by missing alias? is this what you are looking for?
var query = db.Query("Transaction")
.SelectSum("Amount as Total_2020", q => q.WhereDatePart("year", "date", 2020))
.SelectSum("Amount as Total_2021", q => q.WhereDatePart("year", "date", 2021))
.SelectSum("Amount as Total_2022", q => q.WhereDatePart("year", "date", 2022))
check more examples here https://github.com/sqlkata/querybuilder/blob/master/QueryBuilder.Tests/MySqlExecutionTest.cs#L237
That's exactly what I'm looking for. Thank you
This PR adds the support for the
SelectAggregate
method and it's siblingsSelectSum
,SelectMax
,SelectMin
,SelectAvg
,SelectCount
methods, this is better than usingSelectRaw
.All these methods accepts an optional
filter
parameter to filter the aggregated column based on a specified conditions, this will translate to the Aggregation Filter clause on supported compilers like PostgreSQL, and SQLite with a fallback toCASE WHEN
statement for the unsupported ones.Related #507