eBiss 3

Hilfe & Dokumentation

User Tools

Site Tools


Sidebar

en:howtos:messagesovertime

Statistical distribution of messages over time

The following SQL statements evaluate the distribution of incoming messages over time and thus give an indication of the times of greatest utilization.

per hour

SELECT DATEPART(hour,EntryDate) AS OnHour,
       COUNT(*) AS Totals
FROM [eBiss3].[dbo].[Message]
GROUP BY DATEPART(hour,EntryDate)
       order by OnHour asc

per day and hour

SELECT CAST(EntryDate as date) AS ForDate,
       DATEPART(hour,EntryDate) AS OnHour,
       COUNT(*) AS Totals
FROM [eBiss3].[dbo].[Message]
GROUP BY CAST(EntryDate as date),
       DATEPART(hour,EntryDate)

per hour with percentage and bar chart

DECLARE @TotalMessages INT;
SET @TotalMessages = select COUNT(*)from [eBiss3].[dbo].[Message];

SELECT 
       DATEPART(hour,EntryDate) AS OnHour,
       COUNT(*) AS Totals,
       CAST(round(COUNT(*) * 100.0 /@TotalMessages, 1) as decimal(5,1)) as Percentage,
       REPLICATE ( '*' , COUNT(*) * 100.0 /@TotalMessages) as BarGraph
FROM [eBiss3].[dbo].[Message]
GROUP BY 
       DATEPART(hour,EntryDate)
       order by OnHour asc
en/howtos/messagesovertime.txt · Last modified: 2024/02/20 08:15 by 127.0.0.1