0

I was looking for a way to do nested iteration over the PostgreSQL function results or select query that finally give me desired output

for(answers of query 1) { for(answer of query 2) { select x from Table A where a='answer from query 1 & b>='answer of query 2(1)' & b<='answer from query 2(2)' } }

My 'second for' loop returns 2 value using each and every result from my 'first for loop'.

I found this post but its doesn't explains me nested for loop

Laveena
  • 453
  • 1
  • 7
  • 24
  • 1
    Hard to give an answer if there is no real code visible, but *I* would say that you should write this as a single query with a join. – Laurenz Albe Aug 09 '18 at 07:12
  • Second that, I realized its not a good practice to use loop in procedural language – Laveena Aug 09 '18 at 11:06

0 Answers0