Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

query results as string

$
0
0

Hi,

We are using SQL Server 2005
I have a select query like this:

 Select  distinct(column1) From table1 t1 WHERE t1.status in ('AAA', 'DDDD')
except
select column1 from @tmptable

The results are:

Quat123
Qaty345
uios567

I want the result set as string Quat123,Qaty345,uios567

Simple sql, I can do this. But with distinct, it is not working. I can get the result as string by inserting full result into another tmp table and do another select query for string. I am trying to avoid that. I appreciate your response. Column1 can have null values.

Thanks,
Spunny


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>