title: Get the COUNT() in row specific case (the counts will depend on the column)
body: <p>I want to get the count of rows, but ‘counts’ is a specific case.</p>
  
  <h2>TABLE A</h2>
  
  <pre>
     id   |  category  |         time
  =============================================
        1 |          1 |  2015-02-09 12:00:00
        2 |          3 |  2015-02-09 13:00:00
        3 |          2 |  2015-02-09 14:00:00
        4 |          3 |  2015-02-09 14:00:00
        5 |          3 |  2015-02-09 15:00:00
        6 |          1 |  2015-02-09 16:00:00
        7 |          1 |  2015-02-09 16:00:00
        8 |          1 |  2015-02-09 17:00:00
  </pre>
  
  <hr>
  
  <p><strong>'counts' is the same 'category' total counts.</strong></p>
  
  <p><strong>'order' is ordinal number of 'counts' ORDER BY ASC</strong></p>
  
  <p>'order' meaning is like below.</p>
  
  <pre>
   order | counts | id | category |         time
  ========================================================
       1 |      4 |  1 |        1 |  2015-02-09 12:00:00
       2 |      4 |  6 |        1 |  2015-02-09 16:00:00
       3 |      4 |  7 |        1 |  2015-02-09 16:00:00
       4 |      4 |  8 |        1 |  2015-02-09 17:00:00
  
       1 |      1 |  3 |        2 |  2015-02-09 14:00:00
  
       1 |      3 |  2 |        3 |  2015-02-09 13:00:00
       2 |      3 |  4 |        3 |  2015-02-09 14:00:00
       3 |      3 |  5 |        3 |  2015-02-09 15:00:00
  </pre>
  
  <hr>
  
  <p>How can I write a query to get the results below? (Add two columns)</p>
  
  <h2>Results</h2>
  
  <pre>
   order | counts | id | category |         time
  ========================================================
       1 |      4 |  1 |        1 |  2015-02-09 12:00:00
       1 |      3 |  2 |        3 |  2015-02-09 13:00:00
       1 |      1 |  3 |        2 |  2015-02-09 14:00:00
       2 |      3 |  4 |        3 |  2015-02-09 14:00:00
       3 |      3 |  5 |        3 |  2015-02-09 15:00:00
       2 |      4 |  6 |        1 |  2015-02-09 16:00:00
       3 |      4 |  7 |        1 |  2015-02-09 16:00:00
       4 |      4 |  8 |        1 |  2015-02-09 17:00:00
  </pre>
  
  <hr>