ORDER BY

 

Eloquera supports ORDER BY statements. In general ORDER BY statements can contain any set of logical operations separated by comma.

 

Also supports ASCENDING and DESCENDING orders.

 

SELECT [SKIP count][TOP count] TypeName

[WHERE    {Expression [AND|OR] }[..n]]

[ORDER BY {Expression}[,] [ASC|DESC]}[..n]]

 

By default an ASCENDING order is used.

 

For example the following statement orders by name and then by DateTime BirthDate (by default, ascending order is used)

 

var res = db.ExecuteQuery("SELECT BasicUser WHERE Name = 'John' ORDER BY Name ASC, BirthDate");

 

Or there could be a more complex statement. The following statement puts in front objects where condition is true:

 

var res = db.ExecuteQuery("SELECT BasicUser WHERE Name = 'John' ORDER BY Interests in @interest");

 

Or, the following statement uses a complex object:

 

var res = db.ExecuteQuery("SELECT BasicUser WHERE Name = 'John' ORDER BY HomeLocation.Country");