No need for subquery. Use an outer join. Try this:
SELECT
e1.ReportID
, e1.ReportName
, e1.FromDate
, e1.ToDate
, e1.Market
, e1.Entity
, e1.Submarket
, e1.CurrencyCode
, e1.Customer
FROM nm1_customer_exempt e1
LEFT JOIN nm1_customer_exempt e2
ON e1.Market = e2.Market
AND e1.Entity = e2.Entity
AND e1.Submarket = e2.Submarket
AND e1.CurrencyCode = e2.CurrencyCode
AND e1.Customer = e2.Customer
AND e2.FromDate >= '2005-11-01 00:00:00'
AND e2.ToDate <= '2005-11-30 00:00:00'
WHERE e1.FromDate >= '2005-12-01 00:00:00'
AND e1.ToDate <= '2005-12-31 00:00:00'
AND e2.ReportID IS NULL;
Jay Pipes
Community Relations Manager, North America, MySQL Inc.
Got Cluster?
http://www.mysql.com/cluster
Personal:
http://jpipes.com