当前位置: 代码迷 >> SQL >> SQL/oracle应用-查询最大版本值话语
  详细解决方案

SQL/oracle应用-查询最大版本值话语

热度:54   发布时间:2016-05-05 11:27:51.0
SQL/oracle应用--查询最大版本值语句
SQL/oracle应用--查询最大版本值语句

直接上代码:
//(1)select t.* from tableA t where not exists(select 1 from tableA where CAK_APPID=t.CAK_APPID and CAK_APPID ='test1' and CAK_VERSION>t.CAK_VERSION)//(2)select * from tableA where CAK_VERSION = (select max(CAK_VERSION) from tableA where CAK_APPID = 'test1' )//(3)用时最短select * from (select t.* from tableA t where t.cak_appid = 'test1' order by CAK_VERSION desc) where rownum=1 

说明:表是以'CAK_APPID'和'CAK_VERSION '为复合主键。查一条语句进行的。

图示:


  相关解决方案