0

I don't understand how to duplicate data based on the total of the data, can you help me to solve this problem, thank you

text total
A 2
B 1

Result


text
A
A
B
Thom A
  • 88,727
  • 11
  • 45
  • 75
okta s
  • 1
  • can you share your latest coding attempt at this problem? – lemon Jun 21 '22 at 16:43
  • What is the maximum number of rows you'll need to replicate? – shawnt00 Jun 21 '22 at 17:18
  • This case solved, and this is my query /*; WITH CTE ([VALUE], totalTrx, startnum) AS( SELECT [VALUE], totalTrx, [startnum] = 1 FROM @transactionTable UNION ALL SELECT [VALUE], totalTrx, [startnum] = (startnum + 1) FROM CTE WHERE (startnum + 1) <= totalTrx ) */ – okta s Jun 22 '22 at 17:26

0 Answers0