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
 General SQL Server Forums
 New to SQL Server Programming
 Distinct Function in COALESCE FUNCTION

Author  Topic 

yaman
Posting Yak Master

213 Posts

Posted - 2008-07-05 : 09:04:47
SIR


I want a Distinct List of Particular column using COALESCE function

SET distinct @SubDeptList =(SELECT @SubDeptList = COALESCE(@SubDeptList + ',', '') + CAST(tbl_application.Level12id AS varchar(50))
from tbl_application

This query giving me a error Pls help me out


Yaman

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-05 : 23:33:46
What was the error? Did you set value for @SubDeptList anywhere else?
Go to Top of Page

yaman
Posting Yak Master

213 Posts

Posted - 2008-07-06 : 03:44:24
quote:
Originally posted by rmiao

What was the error? Did you set value for @SubDeptList anywhere else?



I want the List Of Distinct Subdepartment and my above query giving only First record not all record like

(1,2,3,4,5) this

Yaman
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-09 : 09:49:25
SELECT COALESCE(@SubDeptList + ',', '') + CAST(tbl_application.Level12id AS varchar(50)) as SubDeptList
from tbl_application

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -