Grouping for final Status

ساخت وبلاگ
Hello everyone,

I am pretty new to MySQL, and I have been working with some database reports and got stuck.
Click image for larger version. 
Name:	mysql.PNG 
Views:	7 
Size:	32.9 KB 
ID:	17739

In attached screenshot, there is part of data I need to work with, so where I am stuck at is:
All of this is one object (work_order_unique_id) each of these objects have blocks (masterdata_id) - for each of those blocks there is multiple reasons why it is rejected or accepted and those have multiple records if their status changed over the time.

So what I need to create and am stuck at is the final status of the object (work_order_unique_id) which will be rejected if there is atleast 1 rejected latest status in any of the blocks (masterdata_id), if all the latest statuses are accepted, the overall status for the object is accepted.

Thank you for any ideas or Idea.
Attached Thumbnails
Click image for larger version. 
Name:	mysql.PNG 
Views:	N/A 
Size:	32.9 KB 
ID:	17739 
CodingForums...
ما را در سایت CodingForums دنبال می کنید

برچسب : نویسنده : codingforums بازدید : 173 تاريخ : جمعه 20 بهمن 1396 ساعت: 16:05