SELECT id,NEW_GRADE_ID, CREATE_TIME FROM LXS_USER_GRADE_CHANGE_INFO WHERE id in (SELECT max(id) as id FROM LXS_USER_GRADE_CHANGE_INFO WHERE USER_ID=‘114839’ AND CHANGE_REASON IS NULL GROUP BY NEW_GRADE_ID)
根据上一步去重,再次获取自己需要的某个字段集合
SELECT to_char(CREATE_TIME,‘YYYY-MM-DD’) FROM(SELECT id,NEW_GRADE_ID, CREATE_TIME FROM LXS_USER_GRADE_CHANGE_INFO WHERE id in (SELECT max(id) as id FROM LXS_USER_GRADE_CHANGE_INFO WHERE USER_ID=‘114839’ AND CHANGE_REASON IS NULL GROUP BY NEW_GRADE_ID ))ORDER BY NEW_GRADE_ID ASC,CREATE_TIME ASC