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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AnuPosted Jun 29, 2021, 2:47 PM
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
Sachin SinghPosted Jun 29, 2021, 2:29 PM