Hi All,
I have a sub query. It returns duplicates on the contact number but I would just like the top contact number. How can I do this?
Thanks,
L
Age is a consequence of experience
I have a sub query. It returns duplicates on the contact number but I would just like the top contact number. How can I do this?
Code:
left join
(SELECT p.PartyID, sc1.SubCaseRef, pcn.ContactNumber
FROM SubCase sc1
inner join SubCaseItem sci1 ON sci1.SubCaseID = sc1.SubCaseID
inner join Venue v1 ON sci1.VenueID = v1.VenueID
left join Party p ON p.PartyID = v1.PartyID
left join PartyContactNumbers pcn ON pcn.PartyID = p.PartyID
where v1.VenueID = sci1.VenueID
group by p.PartyID, sc1.SubCaseRef, pcn.ContactNumber
)
contactNumJoin ON a.RehabReference = contactNumJoin.SubCaseRef
Thanks,
L
Age is a consequence of experience