Try
select @returnValue = @returnValue+rtrim(Surgeon)+'; '
FROM (
select Surgeon, MIN(mp.sysorder) AS sord
from dbo.meetings mx inner join
dbo.meetproc mp on mp.meetingnumber=mx.meetingnumber
where mx.meetingnumber = @tiMeetID
GROUP BY Surgeon
ORDER BY sord
) dt1
>
>Thanks, if I remove the order by claus in the subquery, it works, but I need the list of surgeon in the order contained in sysorder, which basicly is 1,2,3 if there are 3 doctors assigned. The problem is, the subquery says I have to have the sysorder field in the return values for if I it in the orderby and distinct. Doing this, I no longer have a dist list. I appreciate your help, and hoping you know a trick around this.
>
<snip>
--sb--