SELECT COUNT(DISTINCT(submitter)) AS submitters, HOUR(created) AS hourcreated, COUNT(*) AS sum-per-hour FROM remedy WHERE (created>='2002-4-25' AND created<='2002-04-30') GROUP BY HOUR(created);
Is this what you want? Gurhan -----Original Message----- From: Graeme B. Davis [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:52 AM To: [EMAIL PROTECTED] Subject: Query question "average per hour per agent" I'm having a problem in a query that I'm trying to do. I have a database of tickets and I want to get "the average numbers of tickets created per agent per hour over a date range" in the format: Hour | Avg per agent This is what I have so far: SELECT HOUR(created) AS hourcreated, COUNT(*) AS sum-per-hour FROM remedy WHERE (created>='2002-4-25' AND created<='2002-04-30') GROUP BY HOUR(created) This query only gives the SUM of tickets per hour. Is there a way to get the number of distinct "submitters" per hour so I can divide that by count to get avg/hour? perhaps I'm not thinking straight and I'm missing something -- any ideas?? Thanks! graeme --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php