数据库|oracle数据库排序后获取第一条数据

场景: 想要获取下列sql的数据的第一条

select NEXT_FOLLOWUP_DATE from PH_CHILD_HEALTH_EXAM where person_info_id = '3afc119ab460497d85f59b1e135ea6b1' order by followup_Visit_Date desc

数据库|oracle数据库排序后获取第一条数据
文章图片

实现:
select NEXT_FOLLOWUP_DATE from (select NEXT_FOLLOWUP_DATE from PH_CHILD_HEALTH_EXAM where person_info_id = '3afc119ab460497d85f59b1e135ea6b1' and is_Cancel = 0 order by followup_Visit_Date desc) where rownum = 1;

【数据库|oracle数据库排序后获取第一条数据】数据库|oracle数据库排序后获取第一条数据
文章图片

    推荐阅读