title: Full Outer Join with Group By
body: <p><strong>[UPDATED]: I have updated the question with the <code>WHERE</code> clause.</strong></p>
  
  <p>I have the following SQL Fiddle. The result is:</p>
  
  <pre><code>|   User |          Name |   Time |
  |--------|---------------|--------|
  |  00001 |     Mary Jane |     12 |
  |  00002 |   Joana Smith |      7 |
  |  00003 |  George Andrz |      2 |
  |  00004 | Julia Roberts |      4 |
  </code></pre>
  
  <p>I am expecting this:</p>
  
  <pre><code>|   User |          Name |   Time |
  |--------|---------------|--------|
  |  00001 |     Mary Jane |     12 |
  |  00002 |   Joana Smith |      7 |
  |  00003 |  George Andrz |      2 |
  |  00004 | Julia Roberts |      4 |
  |  90000 | Anderson Math |      0 |
  |  90001 |      Josh Xin |      0 |
  </code></pre>
  
  <blockquote>
    <p>The difference is: There are some users in the table MainUsers that
    could not have done the TimeSheet yet, so the TimeSheet table is empty
    for the person. But I would like to show the name, with the Time = 0</p>
  </blockquote>
  
  <hr>
  
  <p><a href="http://sqlfiddle.com/#!3/26592/1" rel="nofollow">SQL Fiddle</a></p>
  
  <p><strong>MS SQL Server 2008 Schema Setup</strong>:</p>
  
  <pre><code>CREATE TABLE MainUsers
  (
    id int identity primary key, 
    UserID varchar(5), 
    FullName varchar(500),
  );
  
  INSERT INTO MainUsers
  (UserID, FullName)
  VALUES
  ('00001', 'Mary Jane'),
  ('00002', 'Joana Smith'),
  ('00003', 'George Andrz'),
  ('00004', 'Julia Roberts'),
  ('90000', 'Anderson Math'),
  ('90001', 'Josh Xin');
  
  CREATE TABLE TimeSheet 
  (
    id int identity primary key, 
    UserID varchar(5), 
    FullName varchar(500),
    Minutes int,
    TimeStamp Datetime,
  );
  
  INSERT INTO TimeSheet
  (UserID, FullName, Minutes, TimeStamp)
  VALUES
  ('00001', 'Mary Jane', 240, '2015-09-16 08:16:00'),
  ('00001', 'Mary Jane', 480, '2015-09-16 08:16:00'),
  ('00002', 'Joana Smith', 320, '2015-09-16 08:16:00'),
  ('00002', 'Joana Smith', 120, '2015-09-16 08:16:00'),
  ('00003', 'George Andrz', 120, '2015-09-16 08:16:00'),
  ('00004', 'Julia Roberts', 240, '2015-09-16 08:16:00');
  </code></pre>
  
  <p><strong>Query 1</strong>:</p>
  
  <pre><code>SELECT u.UserID AS [User], u.FullName AS Name,
         SUM(t.Minutes) / 60 AS [Time]
  FROM MainUsers u LEFT JOIN
       TimeSheet t
       ON u.UserID = t.UserID
  WHERE
      month(TimeStamp) = 9 and year(TimeStamp) = 2015
  GROUP BY u.UserID, u.FullName
  ORDER BY u.UserID ASC
  </code></pre>
  
  <p><strong><a href="http://sqlfiddle.com/#!3/26592/1/0" rel="nofollow">Results</a></strong>:</p>
  
  <pre><code>|  User |          Name | Time |
  |-------|---------------|------|
  | 00001 |     Mary Jane |   12 |
  | 00002 |   Joana Smith |    7 |
  | 00003 |  George Andrz |    2 |
  | 00004 | Julia Roberts |    4 |
  </code></pre>
  
  <p>Thanks.</p>