the select statement below slects a list of test id's
select testID from tblTests 
I have the code blow that updates results based on the test ID. I would like to loop through the above code so that i can loop through one ID at a time. How would i loop though all of the test ID's from the statement above?
--get decision from tbloptions
declare @decision nvarchar
declare @newQuestionNo char(10)
declare @suffix char(1)
declare @scenarioID int
declare @scenarioNo int
declare @testsummaryid int
declare @points int
select 
    @decision = tbloptions.decision,
    @newQuestionNo = rtrim(tbloptions.GoToQuestion),
    @points = coalesce(tbloptions.points,0),
    @suffix = tbloptions.GoToSuffix,
    @scenarioID = tbloptions.scenarioID,
    @testsummaryid = testsummaryid 
from 
    tbloptions with(nolock)
    join tbltests on tbloptions.scenarioID = tbltests.scenarioID
        and tbloptions.questionNo = tbltests.questionNo
where 
    tbltests.testid = 
if @newQuestionNo in ('Pass','Neutral','Fail')
begin
--end scenario session
    update tblTestSummaries
    set 
        end_date = getdate(),
        points = @points,
        completed = 1,
        timetaken = dbo.TimeTaken(
            (select 
                start_date 
            from tbltestsummaries
            where testsummaryid = @testsummaryid),
            getdate()),
        result = case 
            when @points > 2 then 'P'
            when @points = 2 then 'I'
            when @points < 2 then 'F'
        end, 
        testSessionID = @testSessionID
    where testsummaryid = @testsummaryid
end
 
     
     
    