You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Legolas Woodland <le...@gmail.com> on 2006/01/10 20:29:43 UTC

How to perform a complex select over TimeStamp field

Hi
Thank you for reading my post.
I have a timeStamp field in a table in derby.
so all my records has a timestamp field.

*how i can select only a restricted records which are in an specific 
priod of time*
for example records that thier timeStamp are between last 30 days ?
is it possible to use CURRENT_DATE ?

How i can get count of all records that their timeStamp is in same day.
for example if i restric the date in a priod of 30 days i should be able 
to return 30 integer number which any of them represent total timeStamp 
which thier day field is one  day.




Re: How to perform a complex select over TimeStamp field

Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Legolas Woodland wrote:
> Hi
> Thank you for reading my post.
> I have a timeStamp field in a table in derby.
> so all my records has a timestamp field.
> 
> *how i can select only a restricted records which are in an specific 
> priod of time*
> for example records that thier timeStamp are between last 30 days ?
> is it possible to use CURRENT_DATE ?
> 
> How i can get count of all records that their timeStamp is in same day.
> for example if i restric the date in a priod of 30 days i should be able 
> to return 30 integer number which any of them represent total timeStamp 
> which thier day field is one  day.


Hi, Legolas,

The timestampadd and timestampdiff functions might help you do what you 
need. They are documented here:

http://db.apache.org/derby/docs/dev/ref/rrefjdbc88908.html

I hope this helps.

regards,

  -jean