On Dec 16, 2007, at 2:40 AM, [EMAIL PROTECTED] wrote:
> from sqlalchemy import *
> m= MetaData()
> trans =Table( 'trans', m, Column( 'date', Date), )
> balance=Table( 'balance', m, Column( 'finaldate', Date), )
>
> b = balance.alias('b')
> sprev = select( [ func.max( b.c.finaldate)],
> b.c.finaldate < balance.c.finaldate
> )
> #correlate is non-generative in 0.3 (ret None) but generative in 0.4
> sprev = sprev.correlate( balance) or sprev
>
> r = trans.c.date > func.coalesce( sprev,0 )
> #, as_scalar=True ) with or without all the same
r = trans.c.date > func.coalesce( sprev.as_scalar(),0 )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---