Hi, I want to no if there any way to add an "Having" constrain to an aggregation select? Example: if i need all sales sum by date having the sales sum > 1000.
Best Regards, TheGodfather
Hi, I want to no if there any way to add an "Having" constrain to an aggregation select? Example: if i need all sales sum by date having the sales sum > 1000.
Best Regards, TheGodfather
Are you using SubSonic 3.0.0.3 or 2.2?
If you're using 2.2, then I don't think you can do it. I'm unsure about 3.0.
SubSonic does have a "having" but you don't explicitly state it.
It is determined from you selecting an Aggregate and adding the Aggregate to the Where clause.
For example (paraphrased from SubSonic AggregateTests.cs)
SubSonic.SqlQuery q = new
Select(Aggregate.GroupBy("ProductID"), Aggregate.Avg("UnitPrice"))
.From("Order Details")
.Where(Aggregate.Avg("UnitPrice"))
.IsGreaterThan(50);
The SubSonic query above will create a SQL statement with a "HAVING AVG(UnitPrice) > 50"