| | |
| | | from (select cd.*, |
| | | cr.is_according, |
| | | ca.is_correct, |
| | | cc.supervise_details_correct_id |
| | | cc.supervise_details_correct_id, |
| | | case |
| | | when cr.is_finish = 1 then 2 |
| | | when cr.supervise_details_record_id is not null then 1 |
| | | else 0 |
| | | end record_status, |
| | | case |
| | | when ca.is_finish = 1 then 2 |
| | | when ca.supervise_details_according_id is not null then 1 |
| | | else 0 |
| | | end according_status, |
| | | case |
| | | when cc.is_finish = 1 then 2 |
| | | when cc.supervise_details_correct_id is not null then 1 |
| | | else 0 |
| | | end correct_status |
| | | from cnas_quality_supervise_details cd |
| | | left join cnas_quality_supervise_details_record cr |
| | | on cr.supervise_details_id = cd.supervise_details_id |