store list of data into variable store procedure

First of all i excuse me if this question looks very simple for you. Since, i have no idea how to write sp i am posting this question:

Basically i want to write store procedure for and my use case is:

  1. select distinct id from table

select id from [table_name]

  1. Iterate for all id fetched

  2. Do a query again on another table with this id as parameter

  3. Fetch data

Can anyone please suggest how to achieve this ?



Read more here: https://stackoverflow.com/questions/66997749/store-list-of-data-into-variable-store-procedure

Content Attribution

This content was originally published by Rohitesh at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: