Board index » delphi » Getting Count of Log Items in a given year

Getting Count of Log Items in a given year

I need to count the number of log items for a given year. My current SQL
statement is:

select count(*)
from ClientLog
where Client_Id = :ClientID;

I would like to change that so that a TimeStamp field's year value is equal
to an integer param I pass in, something like:

select count(*)
from ClientLog
where Client_Id = :ClientID
and ExtractYear(Event_DateTime) = :Year

How can I do this (without adding DLL's, which I don't have the option to
do)?

Thanks
Ed Dressel

 

Re:Getting Count of Log Items in a given year


Hi Ed,

Quote
> I need to count the number of log items for a given year. My current SQL
> statement is:

> select count(*)
> from ClientLog
> where Client_Id = :ClientID;

> I would like to change that so that a TimeStamp field's year value is equal
> to an integer param I pass in, something like:

> select count(*)
> from ClientLog
> where Client_Id = :ClientID
> and ExtractYear(Event_DateTime) = :Year

> How can I do this (without adding DLL's, which I don't have the option to
> do)?

Assuming IB6 ( you didn't tell us ) - use:

EXTRACT ( YEAR FROM Event_DateTime ) = :Year

Did you read the documentation?

--

With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."

Other Threads