title: Get Latest Date for Device In One Table and Pull Related Field From Second Table
body: <p>I have "table1"...</p>
  
  <pre><code>╔══════════╤═════════════════════════╤══════════╤══════════╗
  ║ EventID  │ UpdateTime              │ User     │ DeviceID ║
  ╠══════════╪═════════════════════════╪══════════╪══════════╣
  ║ 1        │ 2018-03-27 17:36:34.080 │ Sally    │ 129      ║
  ╟──────────┼─────────────────────────┼──────────┼──────────╢
  ║ 2        │ 2018-03-27 17:47:44.057 │ Jack     │ 563      ║
  ╟──────────┼─────────────────────────┼──────────┼──────────╢
  ║ 3        │ 2018-03-29 02:14:01.203 │ Bob      │ 789      ║
  ╟──────────┼─────────────────────────┼──────────┼──────────╢
  ║ 4        │ 2018-03-27 17:23:11.350 │ Cathy    │ 352      ║
  ╟──────────┼─────────────────────────┼──────────┼──────────╢
  ║ 5        │ 2018-03-27 17:35:31.470 │ John     │ 352      ║
  ╟──────────┼─────────────────────────┼──────────┼──────────╢
  ║ 6        │ 2018-03-27 17:36:34.080 │ Margaret │ 2376     ║
  ╚══════════╧═════════════════════════╧══════════╧══════════╝
  </code></pre>
  
  <p>...and "table2"...</p>
  
  <pre><code>╔══════════╤═════════════╤════════╗
  ║ ID       │ DeviceName  │ Active ║
  ╠══════════╪═════════════╪════════╣
  ║ 129      │ DeviceA     │ False  ║
  ╟──────────┼─────────────┼────────╢
  ║ 563      │ DeviceB     │ True   ║
  ╟──────────┼─────────────┼────────╢
  ║ 789      │ DeviceC     │ True   ║
  ╟──────────┼─────────────┼────────╢
  ║ 352      │ DeviceD     │ True   ║
  ╟──────────┼─────────────┼────────╢
  ║ 2376     │ DeviceE     │ False  ║
  ╚══════════╧═════════════╧════════╝
  </code></pre>
  
  <p>I want to end up with this:</p>
  
  <pre><code>╔═════════════╤═════════════════════════╤══════╗
  ║ DeviceName  │ LatestUpdateTime        │ User ║
  ╠═════════════╪═════════════════════════╪══════╣
  ║ DeviceB     │ 2018-03-27 17:47:44.057 │ Jack ║
  ╟─────────────┼─────────────────────────┼──────╢
  ║ DeviceC     │ 2018-03-29 02:14:01.203 │ Bob  ║
  ╟─────────────┼─────────────────────────┼──────╢
  ║ DeviceD     │ 2018-03-27 17:35:31.470 │ John ║
  ╚═════════════╧═════════════════════════╧══════╝
  </code></pre>
  
  <p>I have already:</p>
  
  <pre><code>SELECT t2.DeviceName, t1.UpdateTime, t1.User
  FROM table1 t1
  INNER JOIN (
      SELECT MAX(UpdateTime) AS 'LatestUpdateTime', DeviceID
      FROM table2
      GROUP BY DeviceID
      ) t2 ON t1.ID = t2.DeviceID
  WHERE t2.Active = 'True'
  ORDER BY t2.DeviceName
  </code></pre>
  
  <p>Which gets me "DeviceName" and "LatestUpdateTime" as I want but I cannot figure out how to get "User" as well.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Had a tough time searching for this and also deciding on title here.  If you have any better ideas, I am interested in that as well.</p>