Hi Guys,This is probablly really simple, but my query below is duplicating rows:select c.irn,convert (varchar, oe.lastevent, 103) as LAST_EVENT,convert (varchar, ce.eventdate, 103) as EVENT_DATE,max(ce.cycle)from cases cleft outer join openaction oe on oe.caseid = c.caseid and oe.lastevent = 163left outer join caseevent ce on ce.caseid = oe.caseid and ce.eventno = 163left outer join status s on s.statuscode = c.statuscode and s.liveflag =1where oe.lastevent = ce.eventnogroup by c.irn, oe.lastevent, ce.eventdate
This is because there is more than one event date associated in the caseevent table. I only want to return the date that goes with the maximum cycle no.Any ideas?