Is fkstoreId and storeid the same thing? I am assuming that it is, because if that were not the case, the query could fail if the subquery returns more than one value. You might also try this:SELECT t.checknumber, t.FKStoreID, t.Dateofbusiness, SUM(t.amount)FROM HstGndTender t LEFT JOIN dpvhstchecksummary s ON s.storeId = t.StoreId AND s.dateofbusiness = t.Dateofbusiness AND s.checkid = t.checknumberWHERE t.storeID = 123 AND t.dateofbusiness = '2012-09-05' AND t.[type] = 1GROUP BY t.checknumber, t.dateofbusiness, t.fkstoreIdHAVING SUM(t.amount) <> SUM(s.NetSales + s.Tax)