Question
both id, and counter have same list length. In fact, they are related in the following way: In the first loop run - id will
both id, and counter have same list length. In fact, they are related in the following way:
In the first loop run - id will be 1, counter will be 6. In the next loop run, id will be 2 and counter will be 7, and so on.
-- I want to accomplish this (simplified pseudocode): id = [1,2,3,4,5] counter = [6,7,8,9,10] 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
This code is just the pseudocode, meant to show that both lists are being utilized by multiple cte's.
Postgres version is PostgreSQL 13.6 (Ubuntu 13.6-1.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
Update: The table does not need to be provided! It can not be provided here anyway. It exists in the database.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started