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 8403591
In Process

The Archive Base Latest Questions

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

I work for a hosting company were we often get requests for installs, new

  • 0

I work for a hosting company were we often get requests for installs, new domains, lag fixes etc. To get a bit of an overview of what is still open I decided to make a really simple ticket system. I have a bit of php knowledge and a bit of MySQL knowledge. For now we will be submitting the tickets ourselves based on e-mails and phonecalls from customers.

I have created the following SQL structure:

|| TICKETS  ||    || STATUSSES  ||    || STATUS-CODES  ||
--------------    ----------------    -------------------
| ID         |    |  ticket_id   |    | ID              |
| cust_name  |    |  status_id   |    | status_txt      |
| cust_cntct |    |  datetime    |    -------------------
| subject    |    ----------------
| message    |    
--------------     

I now want to make the overviw table showing all the existing tickets. A ticket is inserted with a default status. The concurring timestamp will be the time that the ticket was added. Every time a ticket moves to the next status a new status will be added with a timestamp. The newest status is always the current status.

I can’t figure out how to create a query that will get every ticket with its latest status. A simple join will return a ticket as many times as the amount of statusses it has. I want to create a join but only show the results were the timestamp of the status is the newest for a certain ticket.

  • 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-09T22:23:07+00:00Added an answer on June 9, 2026 at 10:23 pm

    Try this:

    SELECT  a.*, b.`datettime`, d.status_txt
    FROM    tickets a
                INNER JOIN statusses b
                    on a.id = b.ticket_ID
                INNER JOIN
                (
                    SELECT  ticket_ID, MAX(`datetime`) CurrentTicketDate
                    FROM    Statuses
                    GROUP BY ticket_ID
                ) c
                    ON  b.ticket_ID = c.tecket_ID AND
                        b.`datetime` = c.CurrentTicketDate
                INNER JOIN Status_Codes d
                    on b.status_ID = d.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently decided to switch the company through which i get my hosting, so
I'm trying to work out what hosting to get for a small pop up
I'm thinking of hosting WordPress on my Dropbox folder for development work. Has anyone
I need to be able to work out what page is hosting my silverlight
Work on asp.net vs05. I have three type of value Like:IsDesign,IsPrinting,IsInstall they are bit
Work on a support helpdesk. New tickets come in and records are created in
I'm using Shared Linux hosting and some PHP I wrote just won't work with
I have some PHP source code that I'm hosting with hosting company XYZ. I'm
I am having trouble installing a cakephp app onto a hosting company this is
I have been recently overhauling a website I built for the company I work

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.