-
Notifications
You must be signed in to change notification settings - Fork 0
Subqueries
Wouter Demuynck edited this page May 15, 2016
·
1 revision
You can use sub-selects to select data from another query. The syntax for this is shown in the following example:
var actual = Sql
.Select("Id", "Name")
.From(new SqlSubquery(Sql.Select("Id", "Name").From("User"), "a"))
.Where(SqlExpression.Equal("Id", 42))
.ToSql();
Which yields the following SQL:
SELECT [Id], [Name] FROM (SELECT [Id], [Name] FROM [User]) [a] WHERE [Id] = 42