Oracle获取最新一条数据sql

获取最新一条数据可以根据以下两种方法获取,提供参考如下:

一、select kd.CREATEUSERID as userid,kd.LOCATION,kd.createtime as location from KT_DEVICESTRACK kd where rownum=1 order by kd.createtime
二、SELECT * FROM (
SELECT *,ROWNUM rn FROM t ORDER BY date_col DESC
) WHERE rn = 1

 

你可能感兴趣的:(java学习笔记,oracle)