seems like thisselect oscl.custmrname, oscl.callid,oscl.createdate,oscl.assigndate, oclg.clgcode, oclg2.cntctdate,datediff(dd,oscl.assigndate,oclg.cntctdate) as Diff, oscl.closedate, ohem.firstname, oscs.name from oscl left join (select o1.* from oclg o1join (select parentid,min(cntctdate) as firstfrom oclggroup by parentid) o2on o2.parentid=o1.parentidand o2.first=o1.cntctdate)oclg2on oscl.callid = oclg2.parentid left joinohem on oscl.technician = ohem.empid left joinoscs on oscl.status = oscs.statusid