Board index » delphi » SQL Query By Month

SQL Query By Month

Hi i need to write a query where i extract certain information based on a
certain month/year i have a date field in my table and i need to write a
where clause where month is say november (11) is there a way of doing it
besides using date>= and date <= ?

Thanks

Tim

 

Re:SQL Query By Month


IB 6.0 introduces the new EXTRACT keyword.  It allows you to extract the month.

Quote
Tim Horn wrote:

> Hi i need to write a query where i extract certain information based on a
> certain month/year i have a date field in my table and i need to write a
> where clause where month is say november (11) is there a way of doing it
> besides using date>= and date <= ?

> Thanks

> Tim

--
Jeff Overcash (TeamB)   I don't think there are any Russians
(Please do not email    And there ain't no Yanks
 me directly unless     Just corporate criminals
 asked.  Thank You)     Playing with tanks.  (Michael Been)

Re:SQL Query By Month


Quote
"Jeff Overcash (TeamB)" wrote:

> Tim Horn wrote:

> > Hi i need to write a query where i extract certain information based on a
> > certain month/year i have a date field in my table and i need to write a
> > where clause where month is say november (11) is there a way of doing it
> > besides using date>= and date <= ?

> IB 6.0 introduces the new EXTRACT keyword.  It allows you to extract the month.

        ...but using SOME_DATE BETWEEN '11/1/2001' AND '11/30/2001' is much
more efficient in a WHERE clause, because it can use an index instead of
running a function on every record in the query.

        -Craig

Re:SQL Query By Month


..
where extarct(month from ADATE) = 11

Other Threads