Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDF - Return on distict listing
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01060504
Message ID:
01061174
Views:
14
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform