>>>>I have a table with a datetime field. I would like to count the number of records that exist per year to get a result set something like this:
>>>>
>>>>
>>>>count year
>>>>
>>>>42 1994
>>>>67 1995
>>>> .
>>>> .
>>>> .
>>>>234 2005
>>>>42 2006
>>>>
>>>>
>>>>Any assistance would be appreciated.
>>>>
>>>>Thanks,
>>>>Einar
>>>
>>>
>>>SELECT YEAR(datetimefield) ,count(*) from table group by YEAR(datetimefield)
>>>
>>
>
>As far as I know, year() is a VFP function. Try DATEPART instead:
>
>select datepart(yy, datetimefield)....
YEAR is a valid MSSQL function. I tried datepart(yy, datetimefield) but Paradox did not like that either.
Semper ubi sub ubi.