2 Replies Latest reply: Mar 28, 2013 7:05 AM by BluShadow RSS

    count

    mbb774
      HI All,

      I have a new requirement and need your help


      we have 2 tables T1 and T2

      T1
      delay_in_days
      Delay_in_Weeks

      T2
      object_id
      object_type_id
      documents


      select *from T1;

      delay_in_days Delay_in_Weeks object_id
      0 2 1
      2 5          2
      8 3          3
      15 3          4
      16               6          5
      6               16 6
      3               17 7
      4               18 8
      0               3 9
      0               15 10


      select *from T2;


      object_id object_type_id documents
      1          101 23
      2     102 15
      3           103 16
      4          104 2
      5          105 3
      6          106 12
      7          107 18
      8          108 10
      9          109 6
      10          110 7


      requirement


      if no values are present in the Delay_in_Weeks then count the values found in the delay_in_days

      Special Handle:
      If delay_in_days is populated and it is <=7, then count the number of documents for the object_id .


      If delay_in_days OR Delay_in_Weeks are not populated, then do not count the documents . If delay_in_days is populated and it is >7, then look at Delay_in_Weeks column. If column has a values from 1-16, then count how many documents have delay_in_days >7 for each week row. There will always be 16 rows hardcoded in the report.

      Final output should looklike

      Weeks     delay_numbers
           
      0     3
      1     1
      2     0
      3     1
      4     0
      5     0
      6     0
      7     0
      8     0
      9     0
      10     0
      11     0
      12     0
      13     0
      14     0
      15     0


      here weeks column is a hard coded column and this column should always populate from 0 to 15 values
        • 1. Re: count
          Ramin Hashimzadeh
          this your 4th question and all your question is inexplicit
          • 2. Re: count
            BluShadow
            Please ensure you read: {message:id=9360002}

            People here don't mind helping if a) you've posted sufficient details (and formatted code/data) to describe your issue and b) you've shown that you've had a go at solving the issue yourself.

            Just posting some requirements and asking people to do the work is not acceptable. It doesn't demonstrate that you've tried to tackle this yourself, or indicate what issue you've had in trying to solve it yourself. Everyone here has got their own jobs to do, without doing yours as well.