I can't tell if there is much speed difference since I don't have original table data. Could be some hundreds of rows, could be millions.create index ix_cust on cust (END_TMST, sysid, ky_nm, custid) -- create covered index.-- do the workselect distinct c.CustIDfrom cust cinner join ( select SysID, KY_NM from cust where END_TMST = '9999-09-09-00.00.00.000000' group by SysID, KY_NM having count(*) > 1 ) z on z.SysID = c.SysID AND z.KY_NM = c.KY_NM
Peter LarssonHelsingborg, Sweden