Skip to content

Commit 06a1a07

Browse files
committed
Add HAVING clause to be compiled by CompileNestedCondition
1 parent 27f5dc4 commit 06a1a07

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

QueryBuilder/Compilers/Compiler.Conditions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,14 @@ protected virtual string CompileBasicDateCondition(SqlResult ctx, BasicDateCondi
170170

171171
protected virtual string CompileNestedCondition<Q>(SqlResult ctx, NestedCondition<Q> x) where Q : BaseQuery<Q>
172172
{
173-
if (!x.Query.HasComponent("where", EngineCode))
173+
if (!(x.Query.HasComponent("where", EngineCode) || x.Query.HasComponent("having", EngineCode)))
174174
{
175175
return null;
176176
}
177177

178-
var clauses = x.Query.GetComponents<AbstractCondition>("where", EngineCode);
178+
var clause = x.Query.HasComponent("where", EngineCode) ? "where" : "having";
179+
180+
var clauses = x.Query.GetComponents<AbstractCondition>(clause, EngineCode);
179181

180182
var sql = CompileConditions(ctx, clauses);
181183

0 commit comments

Comments
 (0)