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 |
Yaserq8
Starting Member
2 Posts |
Posted - 2013-12-25 : 04:55:03
|
Good afternoon,I have a table @TempAnswers that looks like this:QNo QA 1 A 1 B1 C 2 A2 B2 C3 A3 B 3 CI would like to shuffle QA randomly while keeping the same QNo in a stored procedure. So sort of shuffling QA grouped by QNo for the lack of a better term. I'd like to get something like this:QNo QA 1 B 1 A1 C 2 C2 B2 A3 A3 C 3 BIf anyone can help I would appreciate it.Thank you for reading.Regards |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-12-25 : 09:44:49
|
[code]select QNo, QA from @TempAnswers order by QNo, newid()[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
Yaserq8
Starting Member
2 Posts |
Posted - 2013-12-26 : 01:53:53
|
Thank you very much Khtan. That did it. |
 |
|
|
|
|