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.
| Author |
Topic |
|
anil.murakonda
Starting Member
4 Posts |
Posted - 2011-04-20 : 04:37:52
|
| My Table is Empno Ename 1 Anil 2 Ravi 1 Kumar 2 KumarI want to display like this empno ename 1 Anil,Kumar 2 Ravi,Kumar how o write query Above o/p....?Anilchow.. |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
|
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-04-20 : 05:18:15
|
| In this Kumar is fixed for all name?Raghu' S |
 |
|
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-04-20 : 05:21:34
|
| declare @t table (id int , Fname nvarchar(25))insert into @tselect 1,'Anil' union allselect 2,'Ravi' Union allselect 1,'Kumar' union allselect 2,'Kumar'Select a.id,a.Fname+' '+b.Fname from @tas a left outer join @t as b on b.id=a.id where a.id=b.id and a.Fname<>b.Fname and b.Fname like ('%Kumar')Raghu' S |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-04-20 : 05:58:11
|
quote: Originally posted by anil.murakonda My Table is Empno Ename 1 Anil 2 Ravi 1 Kumar 2 KumarI want to display like this empno ename 1 Anil,Kumar 2 Ravi,Kumar how o write query Above o/p....?Anilchow..
How do you determine the sequence ? example : 'Ravi, Kumar' and not 'Kumar, Ravi' ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|
|