1 Reply Latest reply on Jan 7, 2019 1:57 PM by Patrick A Van Der Hyde

    SQL code for calculating percentage over time period


      looking to combine certain data, but my SQL knowledge is lacking to do so...


      I've got an employee table:

      employeeID 1

      employeeID 2

      employeeID 3


      A table with subtypes:

      subtype 100

      subtype 200


      And I've got time.


      Everyday an employee will have a certain subtype. For example:


      JAN 2017 week 1:

      employee1 subtype 100

      employee2 subtype 100

      employee3 subtype 100


      FEB 2017 week 2:

      employee1 subtype 100 (day 1-3)

      employee1 subtype 200 (day 4-5)

      employee2 subtype 100

      employee3 subtype 100



      I need to calculate the percentage of employees that do not have subtype 200 over the selected time period (ideally over the span of 52 weeks).



      How can I do this? Thanks a lot for helping!