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 in an old mailing list post (using SA 0.4)

This is what I figured:

q=session.query(Table)
querylist=[q.order_by(Table.b).limit(5), q.order_by(Table.a).limit(5)]

sel = q.union_all(*[q.self_group() for q in querylist])

But I get an error, that Query has not self_group attribute.

Seems self_group is not longer a Query member. So how would I create a query like this?

cheers

Sebastian

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to