Question

Locked

sql query permutations without repetition

By Qrosh ·
I need a query which can be used in (or as) a function and retrieves all permutations of n values. And I need all permutations of length k where k = 1..n.

Extended sample input and result so input has 3 values instead of 2 - however, number of input values may vary from 1 to n.

Example:

Input: table with values in one column in multiple rows

Value (nvarchar(500))
------
Ann
John
Mark

Output#1: table with values concatenated in one column

Ann
John
Mark
Ann,John
Ann,Mark
John,Mark
Ann,John,Mark

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums