title: SQL: Union or Self Join
body: <p>I have a simple table:  user(id, date, task)</p>
  
  <p>The task field contains either "download" or "upload"</p>
  
  <p>I want to figure out the number of users who do each action per day. </p>
  
  <p><strong>Output</strong>: date, # of users who downloaded, # of users who uploaded </p>
  
  <p>I first ran into the issue of using a subquery in the aggregate count function of the select, so I thought I should be using a self join here to break apart the data in the "task" column.</p>
  
  <p>I thought I could create to tables for each case and then combine those and count, but I am having trouble finishing this out:</p>
  
  <p>SELECT id, date, task as task_download
  FROM user
  WHERE task = 'download'</p>
  
  <p>SELECT id, date, task as task_upload
  FROM user
  WHERE task = 'upload'</p>