Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Help On Query

Author  Topic 

BigRetina
Posting Yak Master

144 Posts

Posted - 2002-09-02 : 06:25:30
Salute...
I have the following column in a table..
Codes
-----
SP1
SP2
SP3
SP3
SP3

How can I return the following:
SP1,SP2,SP3
in one query??..


AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-09-02 : 07:17:37
lookup following items in SQLTEAM of BOL.....there are many examples of the use of both


1...COALESCE (for appending results)
2...DISTINCT (for getting unique values)

Go to Top of Page

BigRetina
Posting Yak Master

144 Posts

Posted - 2002-09-02 : 08:05:19
quote:

lookup following items in SQLTEAM of BOL.....there are many examples of the use of both


1...COALESCE (for appending results)
2...DISTINCT (for getting unique values)





First Of All..Thanks..
I know of both keywords..BUT what I can NOT see is how to COALESCE a column with itself and produce a string of the concatenated sub strings.
I need to return ONE string that has the value of "SP1,SP2,SP3" of the previous table..
Thanks Again

Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-09-02 : 08:41:30
as stated before....a SEARCH of SQLTEAM for COALESCE would have been useful for you to undertake....


please do NOT underestimate the power of trying to help yourself!



and a "forum search" using the keyword above should have turned up the following link (amongst many others) ....and the bit of most use to you is the last section.....

http://www.sqlteam.com/item.asp?ItemID=2368

Go to Top of Page

BigRetina
Posting Yak Master

144 Posts

Posted - 2002-09-02 : 08:49:28
Chill man..
well thanks but i was walking the wrong road from the begining!..So I couldnt see how to help myself!
Anyway..
Thanks

Go to Top of Page
   

- Advertisement -