Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8331835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:32:23+00:00 2026-06-09T02:32:23+00:00

So, we have a table that basically includes most of the ticket details of

  • 0

So, we have a table that basically includes most of the ticket details of a ticket, except for stuff that is horribly long (like notes, tech notes, pictures, etc), those are linked elsewhere in other tables, etc.

We want to return metrics about the various tickets in the data table. For example:

SELECT Category, Count(Category) FROM tickets 
WHERE Date_SUB(CURDATE(), Interval 16 Hour) <= Datez GROUP BY Category

Which would return a result listing, for example, each of our categories, and their counts.

However, if we want to adjust this for various intervals, like return the numbers for say 16 hours, 1 day, 30 day, 3 month, 12 month and All time, are we going to have to run that same query that # of times (like for each of those listed minus all time, run that query 5 times?

Ultimately, we want to use the counts in a dashboard of some sort in our C# Winforms application, that will show us various ticket data, so we can see how the department is doing; but, if we have to sit there and run say 5 queries every few minutes, that can tend to bog down the system no?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:32:25+00:00Added an answer on June 9, 2026 at 2:32 am

    You could try something like this:

    SELECT
        Category,
        IF(Date_SUB(CURDATE(), Interval 16 Hour) <= Datez, SUM(1), 0) AS c16hours,
        IF(Date_SUB(CURDATE(), Interval 1 day) <= Datez, SUM(1), 0) AS c1day,
        IF(Date_SUB(CURDATE(), Interval 30 days) <= Datez, SUM(1), 0) AS c30days,
        (...)
    FROM tickets 
    GROUP BY Category
    

    This should work (but I have not tested the example, just giving you some theory)!

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm seeing basically the same issue described here I have a table that starts
I have an application that shows data from a MySQL table. Basically, my application
Basically I have a database with two tables, that is, Updates table and Images
I have a table that looks like this: id value AGA 0.211 AGA 0.433
I have a table that looks like this: CREATE TABLE foobar ( id SERIAL
Basically I have a table that is being used to display data from an
I have a query that basically combines tables of actions and selects from them
I have table that I insert data with following query (from c# code): INSERT
I have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45
I have a table that contains multiple dropdown menus for a list of profile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.