 <p>Use:</p> <pre><code> SELECT a.id FROM ORDERHISTORYTABLE AS a LEFT JOIN (SELECT e.EmailAddress, e.product, MAX(OrderDate) AS max_date FROM OrderHistoryTable AS e WHERE e.Product IN ('ProductA','ProductB','ProductC','ProductD') GROUP BY e.EmailAddress) b ON b.emailaddress = a.emailaddress AND b.max_date = a.orderdate AND b.product = a.product WHERE x.emailaddress IS NULL AND a.Product IN ('ProductA','ProductB','ProductC','ProductD') </code></pre>