Nothing super major here. I have a query that I run multiple times against our ticket system to figure the average number of tickets per month. Right now I just have the query in the middle of a PHP loop to run it for several months and it works. But I'm wondering if there's a way to do it in just a single query. Here's what I have now:
Is there a way to make that loop to grab, say, the last 3 months? Or maybe pass it the last 3 months from the PHP script. I'm just wanting to get it down to one query rather than the current 3.Code:SELECT COUNT(os_ticket.ticket_id) FROM ticketsys WHERE ticketsys.created BETWEEN '2010-08-01' AND '2010-08-31'
Thanks.





I'm going back through a few of my easier reports looking for ways to optimize them so that I can learn enough to tackle a huge Oracle report I have that takes 10 minutes to run.
Bookmarks