title: How can I group by in subquery or how can achieve my output
body: <p>This is my query: </p>
  
  <pre><code>SELECT dte,((SELECT COUNT(prdt) as P1 FROM table
  WHERE prdt LIKE '%P1%' AND stat= 'Done' AND dte  BETWEEN '08/01/2016' AND '09/07/2016') as P1,
  
  (SELECT COUNT(prdt) as P2 FROM table
  WHERE prdt LIKE '%P2%' AND stat= 'Done' AND dte  BETWEEN '08/01/2016' AND '09/07/2016') as P2,
  
  (SELECT COUNT(prdt) as P3 FROM table
  WHERE prdt LIKE '%P3%' AND stat= 'Done' AND dte  BETWEEN '08/01/2016' AND '09/07/2016') as P3
  
  FROM table WHERE dte BETWEEN '08/01/2016' AND '09/07/2016' GROUP BY dte
  </code></pre>
  
  <p>table</p>
  
  <pre><code>+-------------------+
  |  dte1  |prdct|stat|
  +--------+-----+----+
  |8/1/2016|  P1 |Done|
  +--------+-----+----+
  |8/2/2016|  P2 |Done|
  +--------+-----+----+
  |8/3/2016|  P1 |Done|
  +--------+-----+----+
  |8/1/2016|  P3 |Done|
  +--------+-----+----+
  </code></pre>
  
  <p>This is what I want output:</p>
  
  <pre><code>+--------+----+----+----+
  |  Dte1  | P1 | P2 | P3 |
  +--------+----+----+----+
  |8/1/2016|  1 |NULL|  1 |
  +--------+----+----+----+
  |8/2/2016|NULL|  1 |NUll|
  +--------+----+----+----+
  |8/3/2016| 1  |NULL|NULL|
  +--------+----+----+----+
  </code></pre>