I wrote:
Well, it wasn't the r1256 issue. Your example runs fine, but my code still ends up adding the yearly alias to the FROM of the outer query - obviously, my simple examples 'are not the examples I was looking for' - further investigation required.
Ok, found the problem, I was using the aliased table on the LHS of the select(yearly_2.c.date==subquery) instead of the unaliased table from the outer query.
The moral of the story is to use an alias and associated table variable name that are different enough from the unaliased table so the pattern recogniser in your brain isn't fooled too easily!
Robert ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users