[odb-users] Sorted Query Results

Jordan J. Neuhart jneuhart at tlirr.com
Tue Nov 6 09:00:37 EST 2012


Boris,

Thanks again for clarifying things for me.  I think ODB is going to work
well for my project.

Jordan

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Tuesday, November 06, 2012 4:20 AM
To: Jordan J. Neuhart
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Sorted Query Results

Hi Jordan,

Jordan J. Neuhart <jneuhart at tlirr.com> writes:

> Is it possible to have a query return a result set sorted by a 
> particular database column (similar to the "ORDER BY" SQL clause)

Yes, you can add the ORDER BY clause as shown below (based on the person
object from the hello example):

db->query<person> ((query::first == "John") + "ORDER BY" + query::age);

We are also planning to add some syntactic sugar around this in one of
the future versions so that you would be able to write something like
this:

db->query<person> ((query::first == "John") + order_by (query::age));

Boris



More information about the odb-users mailing list