mysql - How to modify my query for the below requirement? -
this query can order_seq_num
2 want value column test_group_id
t_patient_mhc_step_group_mapping
selected order_seq_num
if order_seq_num selected row value 2 in t_patient_mhc_step_mapping
.
select if((labrep.lab_status_id = 2 && labrep.mhc_status = 'mhc'), min(stepmap.order_seq_num) + 1, min(stepmap.order_seq_num)) step_order_seq_num `t_patient_mhc_step_group_mapping` stepgroup inner join t_patient_mhc_step_mapping stepmap on stepgroup.step_id = stepmap.step_id , stepmap.mhc_step_status = 1 inner join `t_patient_mhc_mapping` mhcmap inner join `t_lab_test_report` labrep on labrep.op_ip_appt_id = mhcmap.appt_id mhcmap.appt_id = 81
Comments
Post a Comment