Maximum number of tickets served per hour per service - SQL
P粉919464207
P粉919464207 2024-04-02 16:18:08
0
1
356

This is an answering service that has tickets from several different services and I would like to receive tickets for each service's employees providing service by the hour

I have the following code and database output: Print code

SELECT gfqueuecounter_counter,hora,gfqueue_desc  FROM (SELECT gfqueuecounter_time,gfqueue_desc, gfqueuecounter_counter , SUBSTRING(CONVERT(gfqueuecounter_time,TIME),1,2) as hora
FROM gfqueuecounter_v2 
WHERE gfqueuecounter_time > '2022-06-07 09:00:00' and gfqueuecounter_time < '2022-06-07 18:00:00') as t1;

The red line is an example of the line I want to see from the table, but only starting at 9 o'clock

The column "gfqueuecounter_counter" is a counter for each ticket in each service, but it is counted one by one, so I want to get the last count per hour for that specific service

The "gfqueue_desc" column is a different type of ticket

The "hora" column is displayed every hour

The second "select" is just for me to split "gfqueuecounter_time" into hours

I will be happy to answer any questions

P粉919464207
P粉919464207

reply all(1)
P粉486138196

You should try this, it might work:

SELECT gfqueue_desc, COUNT(gfqueuecounter_counter), SUBSTRING(CONVERT(gfqueuecounter_time,TIME),1,2) as hora
FROM gfqueuecounter_v2  
WHERE gfqueuecounter_time > '2022-06-08 09:00:00' and gfqueuecounter_time 
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!