需求:从一个表中查询数据,得到的数据为最新的一条记录。

-------------建立测试表
--drop table TB
CREATE TABLE  TB(ID INT,Name VARCHAR(100),dtDate date)

-------------插入测试数据
insert into TB VALUES(1,'杰克',to_date('2015/10/12','YYYY/MM/DD'));
insert into TB VALUES(2,'琼斯',to_date('2016/01/12','YYYY/MM/DD'));
insert into TB VALUES(3,'胡巴',to_date('2015/01/12','YYYY/MM/DD'));
commit;

-----------查询出最新一条记录的数据
select * from (select * from TB order by dtDate desc) t where rownum=1

 Oracle查询出最最近一次的一条记录

相关文章:

  • 2022-01-25
  • 2021-12-08
  • 2021-11-17
  • 2022-12-23
  • 2021-11-26
  • 2021-09-12
  • 2021-11-12
  • 2021-06-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案