<分区>
我有下表,
----------------------------------------
|person_id date pstatus px1 |
----------------------------------------
1 29|6|2016 null 089E
1 27|6|2016 Died null
2 29|6|2016 null DFWE
2 27|6|2016 null WEWE
3 29|6|2016 Died null
从上表中,我需要得到以下输出。如果“pstatus”不为空,我需要获取对应于每个 person_id 的记录,如果 pstatus 为空,则需要获取最新日期的记录。
----------------------------------------
|person_id date pstatus px1 |
----------------------------------------
1 27|6|2016 Died null
2 29|6|2016 null DFWE
3 29|6|2016 Died null