SELECT * from patient_state a JOIN (select max(state_id) as state_id from patient_state group by patid) b ON b.state_id = a.state_id ORDER BY a.patid asc;
结果:
SELECT * from patient_state a JOIN (select max(state_id) as state_id from patient_state group by patid) b ON b.state_id = a.state_id ORDER BY a.patid asc;
结果: