What is the difference between these 2 queries? We have these 2 queries:

select jsh.jobid, max(jsh.Audit_CreatedDate)
from JobStatusHistories jsh 
join Jobs j on j.JobId = jsh.JobId
where j.JobStatusId = 11 
and jsh.Audit_CreatedBy &lt;&gt; 'Archiver'
and jsh.Audit_CreatedDate &lt; '5/9/2015'
group by jsh.jobid


and 

select jsh.jobid 
from JobStatusHistories jsh 
join Jobs j on j.JobId = jsh.JobId
where j.JobStatusId = 11 
and jsh.Audit_CreatedBy &lt;&gt; 'Archiver'
group by jsh.jobid
having MAX(jsh.Audit_CreatedDate) &lt; '5/9/2015'


The first returns 5.3 million records and the second returns 4.3 million. 

The goal is to get a list of jobids where the job status is 11 and has been modified over 5 months ago (old) but they may have been modified recently by the Archiver, so we want to ignore those.

Simplified data might look like:

JobId    Audit_CreatedDate    Audit_CreatedBy
234      3/25/2015            Importer
234      9/25/2015            Archiver
456      8/25/2015            Importer
456      9/25/2015            Archiver
789      3/25/2015            Importer
789      4/25/2015            Archiver


We would expect to get back:

JobId    Audit_CreatedDate    
234      3/25/2015            
789      3/25/2015            


Unfortunately, both queries return so many results, it's difficult to see which is doing what we want.
The difference is that the first query will include a job like this:

jobId    Audit_CreatedDate
-------  -----------------
1        2015-04-01
1        2015-06-01


The first row would be included in the query, but the second row won't be included. This is because at least one row from that job met the where clause of &lt; May 9th (or is that September 5th? Please use non-regional, unambiguous date literals).

This same job would be excluded from the second query altogether, since the filter is effectively applied on the aggregate, not on individual rows. MAX(date) = June 1st in that case, and so the job is thrown out as a whole, rather than just the rows &gt; May 9.

Which query is right? Who knows? You'll need to give more details about your actual requirements - your current word problem is not explicit enough for me to understand. Not that any user or client could consume 4.3 or 5.3 million rows anyway.