Search

Wednesday, September 24, 2014

How to Execute a Sub-Query in SubSonic

Pretty simple but not easy to find:

listOfType = New SubSonic.Select() _
    .From(TableName.Schema) _
    .Where(TableName.Columns.Id).IsEqualTo( _
        New SubSonic.Select(TableName2.Columns.Id) _
        .From(TableName2.Schema) _
        .Where(TableName2.Columns.Id).IsEqualTo(someId) _
        .ExecuteScalar(Of Long)
).ExecuteTypedList(Of TypedList)()
// //]]>