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.