- Joined
- Jul 6, 2005
- Messages
- 36,703
- Likes received
- 1,283
- Thanks received
- 451
G8_Summit said:Since when did looping become part of SQL ??
Looping is programmatical - thats why I said use a program.
Thinking maybe I could do this with a cursor ...
G8_Summit said:Since when did looping become part of SQL ??
Looping is programmatical - thats why I said use a program.
G8_Summit said:Thinking definitely you could do it with a cursor.
Simple loop, counting events until change of name, all the while building your list of event names.
But you would have to use a program.
I could do it in Cobol for you![]()
which is a program, not pure SQL.sasguru said:Thinking maybe I could do this with a cursor ...
scotspine said:declare @mob_rows varchar(260)
select @rowindex = 1
select @mob_rows = ''
while @rowindex < 8
begin -- row loop
select @colindex = @lowercollimit
select @single_row = ''
while @colindex < @uppercollimit
begin -- column loop
select @t = count(*)
from #tempneeds
where
TypeID = 1 -- page
and QuestionID = @rowindex -- rows
and HelpTypeID = @colindex -- columns
and Need = 'y'
select @colindex = @colindex + 1
select @single_row = @single_row + ' ' + ltrim(str(@t)) -- build up the row
end -- column loop
select @rowindex = @rowindex + 1
select @mob_rows = @mob_rows + '/' + ltrim(@single_row) -- concatenate the rows
end -- row loop
