Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion QueryBuilder.Tests/DefineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public void Test_Define_WhereExists()
);

var c = Compile(query);
Assert.Equal("SELECT * FROM [Customers] WHERE EXISTS (SELECT TOP (1) 1 FROM [Orders] WHERE [ShipPostalCode] = '8200')", c[EngineCodes.SqlServer]);
Assert.Equal("SELECT * FROM [Customers] WHERE EXISTS (SELECT 1 FROM [Orders] WHERE [ShipPostalCode] = '8200')", c[EngineCodes.SqlServer]);
}


Expand Down
2 changes: 1 addition & 1 deletion QueryBuilder.Tests/SqlServer/NestedSelectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void SqlCompile_QueryLimitAndNestedLimit_BindingValue()
// var q = new Query().From("Foo").Where("C", "c").WhereExists(n).Where("A", "a");

var actual = compiler.Compile(q).ToString();
Assert.Contains("SELECT * FROM [Foo] WHERE [x] = true AND NOT EXISTS (SELECT TOP (1) 1 FROM [Bar])",
Assert.Contains("SELECT * FROM [Foo] WHERE [x] = true AND NOT EXISTS (SELECT 1 FROM [Bar])",
actual);
// Assert.Contains("SELECT * FROM [Foo] WHERE [C] = 'c' AND EXISTS (SELECT TOP (1) 1 FROM [Bar]) AND [A] = 'a'", actual);
}
Expand Down
5 changes: 2 additions & 3 deletions QueryBuilder/Base.Where.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,7 @@ public Q WhereExists(Query query)

// remove unneeded components
query = query.Clone().ClearComponent("select")
.SelectRaw("1")
.Limit(1);
.SelectRaw("1");

return AddComponent("where", new ExistsCondition
{
Expand Down Expand Up @@ -690,4 +689,4 @@ public Q OrWhereNotTime(string column, object value)
#endregion

}
}
}