标签: sql optimization
SELECT a.eid, a.cid, b.e_date FROM RR_CHARITY a JOIN RR_EVENTS b ON a.eid = b.eid WHERE a.cid IN ( SELECT cid FROM RR_CHARITY_TRANSACTIONS WHERE `trnDate` <= '2013-01-01 00:00:00' ) AND a.eid NOT IN(216,217,322);