title: PostgreSQL Query for grouping column values into columns
body: <p>I have the PostreSQL table shown below. <code>ordered</code> is a boolean column and <code>created_at</code> is a timestamp. I'm trying to fetch rows which tell me the total number of successful orders (<code>count(t)</code>) vs failed ordered (<code>count(f)</code>) as well as the total number of orders (t + f) grouped by day (extracted from <code>created_at</code>)</p>
  
  <p><code>ordered | created_at
  t        | 2018-10-10 20:13:10
  t        | 2018-10-10 21:23:11
  t        | 2018-10-11 06:33:52
  f        | 2018-10-11 13:13:33
  f        | 2018-10-11 19:17:11
  f        | 2018-10-12 00:53:01
  f        | 2018-10-12 05:14:41
  f        | 2018-10-12 16:33:09
  f        | 2018-10-13 17:14:14
  </code></p>
  
  <p>I want the following result</p>
  
  <p><code>
  created_at   | ordered_true  | ordered_false | total_orders
  2018-10-10   | 2             | 0             | 2
  2018-10-11   | 1             | 2             | 3 
  2018-10-12   | 0             | 3             | 3
  2018-10-13   | 0             | 1             | 1
  </code></p>