both id, and counter have same list length. In fact, they are related in the following way:
id 1 has counter value equal to 6 / id 2 has counter value equal to 7 and so on..
id = [1,2,3,4,5]
counter = [6,7,8,9,10]
-- I want to accomplish this (simplified pseudocode):
for i in range(len(id)):
with cte1 as
(select data from table_1 where id = )
with cte2 as
(select * from cte1 where counter = )
select * from cte2 -- this is the final result of one iteration
-- result set of each iteration is unioned together after each loop run