Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Average Time
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Versions des environnements
SQL Server:
SQL Server 2005
Application:
Desktop
Divers
Thread ID:
01414190
Message ID:
01414230
Vues:
28
>Naomi,
>
>That's going to give the 15th day of the month on average which probably isn't what she's looking for.
>
>>select EmployeeID, avg(CheckInTime) as Avg_CheckInTime from CheckIns where CheckInTime between @StartOfTheMonth and @EndOfTheMonth group by EmployeeID
>
>Victoria - if you are looking for the average time of day they are checking in use a query like
>
>
>declare @tClock table ( t1 datetime )
>insert into @tClock values ( '1/1/2009 08:00:00' )
>insert into @tClock values ( '1/2/2009 08:01:00' )
>insert into @tClock values ( '1/3/2009 08:02:00' )
>insert into @tClock values ( '1/4/2009 08:30:00' )
>select avg( datepart( hour, t1 ) * 60 * 60 + datepart( minute, t1 ) * 60 + datepart( second, t1 ) ) / 3600.0
>   from @tclock
>
>
>which is time in decimal hours which you can convert back into a hh:mm:ss format.

You're right, thanks.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform