Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with a query
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01098460
Message ID:
01098473
Vues:
11
SELECT YEAR(DatetimeField) AS year, COUNT(*) 
  FROM mytable GROUP BY YEAR(DatetimeField)
>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
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform