Hello,
I have a table with column values like below in an SQL server database.
| Values |
| A |
| B |
| C |
I need output like below
| Output |
| a,b,c |
| a,c,b |
| b,c,a |
| b,a,c |
| c,a,b |
| c,b,a |
Can some one please check and help me to provide the solution?
Hello,
I have a table with column values like below in an SQL server database.
| Values |
| A |
| B |
| C |
I need output like below
| Output |
| a,b,c |
| a,c,b |
| b,c,a |
| b,a,c |
| c,a,b |
| c,b,a |
Can some one please check and help me to provide the solution?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Jun 29, 2021, 10:29 AM EDT
AnuRank #5,208 · 307 reputationPosted Jun 29, 2021, 10:47 AM EDT
Thanks Sachin for checking this. It works for specific number of rows. But the number of values in the table can be changed. i got the solution from the below link
https://stackoverflow.com/questions/3621494/the-most-elegant-way-to-generate-permutations-in-sql-server