title: Adding a Non aggregate column in query
body: <p>I have to add column named 'Number3'  in the below query.But it is a non aggregate column which if added to select statement and group by clause ,changes the result.</p>
  
  <p>How do i get the same result and add the column named 'Number3'in the query  without adding it to group by clause??</p>
  
  <pre><code>select distinct [Name], 
  max([ArchiveDT]) as [ArchiveDT],
  Number1,
  Number2
  FROM Table
  where ArchiveDT&gt;=dateadd(day, datediff(day, 0, getdate()-1), 0) and
    ArchiveDT&lt;dateadd(day, datediff(day, 0, getdate()), 0)
    and [Name] is not null
  group by [Name] ,Number1,Number2
  </code></pre>