Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all experts,

I have 1 table(Tbl1). it has some fields(TblCode,ItemCode,Name,Name1,qty,Amount)
the data display like this:
1 I0001 Panel B 1 100
1 I0002 Mouse B 1 200
1 I0003 A4Paper C 1 200
1 I0004 Key D 1 10

i want to combine Column Name1 into one string. base on example, it will BCD
Note:
if Name1 is the same, choose only 1. base one example, B has 2 row, but select only 1

What query should i combine string like example?

Thanks

TONY
Posted
Comments
[no name] 9-Sep-12 22:24pm    
What query have you tried to do?

1 solution

SQL
SELECT      '' + Name1 from (select distinct Name1 FROM tbl1) as tbl

               FOR XML PATH('')
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900