Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grouping by hours
Message
De
01/02/2010 18:05:08
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Grouping by hours
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01447023
Message ID:
01447023
Vues:
101
I thought the following would work to group by hours by it is not:
SELECT CONVERT(CHAR(4),YEAR(Hit.AddDate))+REPLACE(STR(MONTH(Hit.AddDate),2),' ','0')+
REPLACE(STR(DAY(Hit.AddDate),2),' ','0')+REPLACE(STR(HOUR(Hit.AddDate),2),' ','0') AS lcChampNumero,
COUNT(*) AS Compte,MIN(Hit.AddDate) AS AddDate 
FROM Hit (NOLOCK) 
 GROUP BY CONVERT(CHAR(4),YEAR(Hit.AddDate))+REPLACE(STR(MONTH(Hit.AddDate),2),' ','0')+
 REPLACE(STR(DAY(Hit.AddDate),2),' ','0')+REPLACE(STR(HOUR(Hit.AddDate),2),' ','0') ORDER BY 1 DESC 
The Hour is not a recognized built-in function name.

What can I do?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform