Assuming I have a table CREATE TABLE seq (i int auto_increment primary key, used bool default false);
And want to query an mapped object from it which corresponds a query SELECT i,used FROM seq WHERE NOT used AND i+1 IN (SELECT i FROM seq WHERE AND used) or (more or less equivalent) SELECT seq.i,seq.used FROM seq JOIN seq AS seq1 WHERE seq.i+1==seq1.i AND NOT seq.used AND NOT seq1.used (retrieve first of n, here - 2, not used numbers in a sequence) Number of subqueries/JOINs might be a runtime parameter. Would be nice to know if it is possible, and if it is - how? Thanks, A --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@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 -~----------~----~----~----~------~----~------~--~---