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

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -