Lets say I have a table 'daily_prices' with a date and a price column. There is also a table 'yearly_values' with a date and a value column. Now these yearly_values aren't very regular, some occur in September, some in June, others December, but I want to select the date and price from the daily_prices only where a corresponding yearly price occurred within 15 months of the the daily price and the yearly value is > 5. This is pretty straightforward in SQL:

  SELECT d.date, d.price FROM daily_prices d, yearly_values y
  WHERE y.value > 5
  AND d.date - y.date BETWEEN '0 months' and '15 months'

Is this achievable in SA (other than by using text() or similar), with the caveat that this requirement is part of a variable set of user selected criteria so the select needs to be built up using the 'statement.append_whereclause()' and 'statement.append_from()' functions?

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to