The solution below comes in very handy for reporting purposes where you really want 1 line of data with associated with mulitple columns.
Enjoy..
DECLARE @StateList VARCHAR(MAX), @ClientID varchar(32)
SET @ClientID = 'YOUR_CLIENT_ID_HERE'
SELECT @StateList = COALESCE(@StateList + ' , ','') + ClientStateList.state
from
(select distinct state
from claddress
where clientid = @ClientID) as ClientStateList
select name, @StateList as USLocations from cl where ClientID = @ClientID
No comments:
Post a Comment