title: Return one record with the max value if there is multiple records
body: <p>I thought it would be cool to have a table that shows three pieces of data. Table Name, Table last updated, Table last queried (in any Form) and the last time the server was started up.</p>
  <p>This is what I came up with,</p>
  <pre><code>SELECT OBJECT_NAME(OBJECT_ID) AS TableName,
  last_user_update AT TIME ZONE 'UTC' AT TIME ZONE 'Central Standard Time' AS Last_Update,
  (SELECT MAX(Last_Used_Date)
  FROM (VALUES
  (last_user_seek), 
  (last_user_scan), 
  (last_user_lookup)) 
  AS value(Last_Used_Date)) 
  AT TIME ZONE 'UTC' AT TIME ZONE 'Central Standard Time' AS Last_Used,
  (SELECT [sqlserver_start_time] AT TIME ZONE 'UTC' AT TIME ZONE 'Central Standard Time'
  FROM sys.dm_os_sys_info) AS Vaules_From 
  FROM sys.dm_db_index_usage_stats
  WHERE database_id = DB_ID( 'DATABASENAME')
  ORDER BY TableName ASC
  </code></pre>
  <p>The issue I’m trying to fix is I get multiple records back from some tables due to them have indexes.</p>
  <p>I want to just return one record with the max value if there is multiple records.</p>