 <p>You can simply do this:</p> <pre><code>SELECT order_date, SUM(CASE WHEN male_or_female_bike IS NULL THEN 1 WHEN male_or_female_bike='M' THEN 1 ELSE 0 END) as MaleCount, SUM(CASE WHEN male_or_female_bike ='F' THEN 1 ELSE 0 END) as FemaleCount FROM Bike_orders GROUP BY order_date ORDER BY order_date DESC </code></pre> <p>Result:</p> <pre><code>ORDER_DATE MALECOUNT FEMALECOUNT April, 08 2014 00:00:00+0000 2 2 February, 12 2014 00:00:00+0000 1 0 </code></pre> <p><kbd><a href="http://www.sqlfiddle.com/#!2/49321/3" rel="nofollow"><strong>Fiddle Demo</strong></a></kbd></p>