How to save final table one column based on the other table fields

Hi Folks ,

Hope all are doing good. Stay home stay safe.

I have one request came (Attached). 

Here, I have two tables. Table A having one column has status like Open, Approved, Rejected, 

Based on this status in Table A, I need to update in another table B with Final Status as showm in attachment.  If table A having all are Open status then Table B - Final Status is Open like that. 

Here my thought is Using for each for Table B then based on the table B Id saving in Table A. So repeating the Table A inside table B with assigning the local variable to the Table A status. 

But not able to get the as per the requirement. 


Cud any one help me on how to approach. 

note: Here table A is having many records but all are with status is either Approved / Rejected / Completed.

Thanks in Advance,

Gangadhara 

Hi Gangadhara,

if i understood correctly,

You have foreign key Table B ID in Table  A. and you need to update Table B status based on Table A status?

Let us clear please.


Regards

Rahul Sahu

Rahul Sahu wrote:

Hi Gangadhara,

if i understood correctly,

You have foreign key Table B ID in Table  A. and you need to update Table B status based on Table A status?

Let us clear please.


Regards

Rahul Sahu

Yes. Correct Rahul. 


Hi,


Use advanced SQL to get the final status from the first table based on your condition and then just update on another table.


Hint: Conditional Group By.


Thanks

Solution

Hi Gangadhara, 

Base on your condition i have made one sample oml for you.

Use demo from here Update Status


also You can modify logic accordingly


Hope this will help you.

Regards

Rahul Sahu

Solution

Thanks Rahul & Jitendra.


@Rahul logic is working. 


Regards,

Gangadhara.

Welcome Gangadhara,

Glad to help you.


Regards

Rahul Sahu