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 |
|
sneupane
Starting Member
28 Posts |
Posted - 2011-11-08 : 19:27:19
|
| I have a data set Table X and Table YTable X------------CategoryABCTable Y-------------Name ID Robert 23Carlos 35Steve 40I was trying to get like shown below;Category Name IDA Robert 23A Carlos 35A Steve 40B Robert 23B Carlos 35B Steve 40C Robert 23C Carlos 35C Steve 40I just could not get a proper control statement to get it work. Any help would be appreciated.ThanksSarSar |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
sneupane
Starting Member
28 Posts |
Posted - 2011-11-08 : 19:48:04
|
| this should be it..great thanks.. oops i was thinking of using a control loop that starts from taking the value "A" and putting along the records for Name and ID. After completing for A it goes to B and so on... is there any way to proceed like this.. kinda curious for my knowledge..Sar |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-11-08 : 20:21:44
|
quote: Originally posted by sneupane this should be it..great thanks.. oops i was thinking of using a control loop that starts from taking the value "A" and putting along the records for Name and ID. After completing for A it goes to B and so on... is there any way to proceed like this.. kinda curious for my knowledge..Sar
That will be using a cursor or while loop. It will required more coding KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2011-11-08 : 21:29:16
|
quote: Originally posted by khtan
quote: Originally posted by sneupane this should be it..great thanks.. oops i was thinking of using a control loop that starts from taking the value "A" and putting along the records for Name and ID. After completing for A it goes to B and so on... is there any way to proceed like this.. kinda curious for my knowledge..Sar
That will be using a cursor or while loop. It will required more coding KH[spoiler]Time is always against us[/spoiler]
And performance will be bad.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
|
|
|