[sqlalchemy] self_group on Query

2010-10-15 Thread Sebastian Elsner
Hello, wanting to create the following query: (SELECT * from tbl ORDER BY b LIMIT 5) UNION ALL (SELECT * from tbl ORDER BY a LIMIT 5) The important thing are the (), which I cant get to work with the examples in the union() docs . I came across a solution involving self_group on Queries

Re: [sqlalchemy] self_group on Query

2010-10-15 Thread Michael Bayer
On Oct 15, 2010, at 7:43 AM, Sebastian Elsner wrote: Hello, wanting to create the following query: (SELECT * from tbl ORDER BY b LIMIT 5) UNION ALL (SELECT * from tbl ORDER BY a LIMIT 5) First note that ORDER BY is not valid at the level you are placing it (many databases won't accept