Hi, I'm using Posgresql, and I want to use the extract function, the
following works but seems a tad ugly...

r= db[:transactions].filter({:EXTRACT['year FROM
transactions.created_at'.lit] => date.year} & {:EXTRACT['month FROM
transactions.created_at'.lit] => date.month} ).all

Is it possible to do something like the following?

r= db[:transactions].filter({:EXTRACT['year FROM '
+ :transactions__created_at] => date.year} & {:EXTRACT['month FROM '
+ :transactions__created_at] => date.month} ).all

As it avoids the .lit, and allows me to use the regular sequel syntax
for column names.

Any better solution suggestions are appreciated :)

MySql allows me to do this: :YEAR[:transactions__created_at] but
postgresql doesn't have the year function.just that ugly EXTRACT[part
FROM expr]

thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to