You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Angus Berry <an...@elken.com> on 2004/03/27 04:59:09 UTC
OQL Select by Month
I wonder if it's possible to construct an OQL Query (or maybe PB) that
is the equivalent of this (in PostgreSQL):
select * from tbl_my_table
where date_part('month', mt_date) = 12;
This selects all records with the month 12. I guess the alternative in
OQL that I'm working with is:
'WHERE >= firstdayofgivenmonth AND <= lastdayofgivenmonth
thanks for any suggestions...
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: OQL Select by Month
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi angus,
crit.addEqual("date_part('month', mt_date)", new Integer(12) )
should do it. possible problem could occur when parsing the criteria expression.
ojb eventually cannot get the attribute-name from the expression.
jakob
Angus Berry wrote:
> I wonder if it's possible to construct an OQL Query (or maybe PB) that
> is the equivalent of this (in PostgreSQL):
>
> select * from tbl_my_table
> where date_part('month', mt_date) = 12;
>
> This selects all records with the month 12. I guess the alternative in
> OQL that I'm working with is:
>
> 'WHERE >= firstdayofgivenmonth AND <= lastdayofgivenmonth
>
> thanks for any suggestions...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org