How can I write a SQL Server stored procedure to get the following output? -


i have sourcetable 2 column names:

  col 1  | col 2 ------------------        |   2   b      |   3   c      |   4   d      |   2   e      |   1   f      |   0 

the first column has letter, , second column carries frequency.

we need write stored procedure , output in targettable this.

we can not use loop, or iteration this.

col 1 -----       b   b   b   c   c   c   c    d   d   e 

how recursive cte?

with x (       select col1, 1 i, col2 lim       t       col2 > 0       union       select col1, + 1, lim       x       + 1 <= lim      ) select col1 x order col1; 

Comments

Popular posts from this blog

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -