How to loop through nth count of a variable in SQL ?
Declare @Count int
Set @Count = select count (*) from Lines where id = 100
I have a column : Line_Reference in the Bill Table. Each Bill id will have this Line Reference column with the values. 1,2,3,..n.
Let's say, if @count = 7
Then Line_Reference = 1,2,3,4,5,6,7
if @count = 3
Then Line_Reference = 1,2,3
