1 Reply Latest reply on Apr 3, 2017 8:34 AM by GreggSmith

    query to get the first row

    SurabhiSingh Rookie

      I need to get the first row query.

      Like, A ticket has been QUEUED for n number of times, I need to find the 1st QUEUED of the ticket.

      Please provide me the SQL query.

        • 1. Re: query to get the first row
          GreggSmith SupportEmployee

          Hello,

           

          Without more specifics, like what product these tickets are in, or what you mean by queued (transferred, maybe?), all I can do it provide a best-guess, generic sample query.

           

          Probably something like:

           

          SELECT TICKET_ID, MIN(ID) FIRST_QUEUE FROM QUEUE_TABLE GROUP BY TICKET_ID

           

          One way to use this is:

          1. Use the above query to create an Xtraction table, called QUEUE_LINK for this example
          2. Link the ticket table to this QUEUE_LINK table on the Ticket IDs (or whatever the common field is)
          3. Create an Xtraction table, called FIRST_QUEUE for this example, that points at the "queue" table
          4. Link the QUEUE_LINK table to the FIRST_QUEUE table on QUEUE_LINK.FIRST_QUEUE = FIRST_QUEUE.ID

           

          I hope this generic solution answers your specific question.