Skip to Content
1
Feb 23, 2021 at 02:23 AM

Loop in DWC? syntax for correct execution

104 Views Last edit Feb 25, 2021 at 01:20 PM 2 rev

Hello

I'm having a problem, trying to do a SQL Script, Table Function in DataWareHouse Cloud

1 . I have a query that returns 2 records as seen in the image belo

Now what I want is to go through this query record by record, I am doing it using a For loop, as seen in the image

What I want to obtain is that for each iteration, a query is made to a table using as a condition the id of the records of the first column, but in the end I only get one record, regardless of whether I add the return output inside or outside the loop.

Try to do the same but using a cursor and I get the same result.

I am trying to make the end with this code. is to iterate to bring you a top 1 of each repeated code.

I appreciate any collaboration.

Attachments

1mxud.png (55.0 kB)
qhqbw.png (75.6 kB)
oqved.png (75.6 kB)
pdips.png (24.8 kB)