Sub-query alias

Mar 4, 2017 at 11:48 AM
Hi, can anyone please assist me in coding this simple query (below). Regardless of the combinations I try I can't alias the Field3 subquery without causing exceptions.

Field1, Field2,
  SELECT TOP 1 OtherField FROM Table2 ORDER BY OtherField DESC
) as Field3,
From Table1;

The C# i'm using for this example follows:

DBQuery querySub = DBQuery.Select()
.OrderBy("OtherField", ORM.Data.Order.Descending);

DBQuery queryMain = DBQuery.Select()

Any help with this is greatly appreciated.
Mar 4, 2017 at 4:30 PM
I managed to get this working by re-structuring the SQL and subsequent C# with a left join.