Ok, so I have a clue but not enough focus to find the final answer here. So . . . .
I have a query that goes something like:
where name like 'xyz%'
In the above, there could be 1 result or there could be 20 based on when I run the query.
I need a loop that will allow me to run a query such as:
select * into #tempResults
select 'ResultName', OtherItem
I need this to run and insert into a temp table one time for each result of the first query.
My apologies in advance for the messy way I presented this. I'm pretty sure I can adapt once I get an example. I'm using DB2 for i series, but I'm sure I could adapt it from MS SQL or anything similar.
Thanks for your assistance!