2 Replies Latest reply on Jul 9, 2017 11:25 AM by xxx202xxx

    ExecuteSQL to pull data from 1 record

    xxx202xxx

      My setup is as follows: I have a Service::TicketID related to Time::TicketID_fk where I could have multiple time entries with varying Statuses.  What I am most interested in are the resolved tickets.  I need to get a count of how many times a ticket has been placed in a resolved status.  I have created a query already that pulls the following which is great for dashboard purposes.

       

      ExecuteSQL ("

      SELECT TicketID_fk, COUNT (Status)
      FROM Time_Management_Incident_Log
      WHERE Status=?
      GROUP BY TicketID_fk"

      ;" -  "; ""; "Resolved")

       

      Results:

      INC001 - 2

      INC002 - 1

      INC003 - 1

       

      Now what I need on my Service Table Layout is the individual count of Resolved Statuses per ticket.  I need help with the calculation to perform this feat.

       

      Example

      TicketID       DateCreated      TimeCreated      CurrentStatus      TimesResolved

      INC001          7/9/2017          12:19:00               Opened               2