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:
select distinct id from table
select id from [table_name]
Iterate for all id fetched
Do a query again on another table with this id as parameter
Fetch data
Can anyone please suggest how to achieve this ?