表结构如下(id,姓名,操作,时间)其中ID是主键,“操作”的取值为增加、修改、删除,“时间”为操作时间。
现要查询如下表示结果:指定时间内的记录,同一姓名的人做过多次操作,取最近的一条。
求解!!!
现要查询如下表示结果:指定时间内的记录,同一姓名的人做过多次操作,取最近的一条。
求解!!!
解决方案 »
- 关于oracle 绑定变量在c++中的实现方式
- 关于Oracle 提取字符问题
- 请教高手,一个使用java添加记录到oracle数据库中的问题
- 关于oracle登陆问题
- 紧急求救oracle10G 导入导出问题。。。。拜托拉。。。
- orecle中sys和system的密码有办法找回吗?
- 请问oracle 10g 下的init.ora文件是在pfile/下的init.ora.12044...一堆数字这个文件吗
- 有关CLOB的问题,在线等候!
- oracle中表的列名能用变量表达吗?
- 我导入数据的时候出现“不支持要求的字符集转换(从类型31到852)”的错误,请问该怎么办啊?
- 高分求sql语句!
- 数据合并,能用一条SQL得到吗?
from (select id,姓名,操作,时间,row_number() over(partiton by 姓名 order by 时间 desc) rn
from table
where 时间=?) a
where a.rn=1
from tb where 时间 in(select 时间 from tb where 时间>=dt and 时间<=dt2 group by 姓名)
from (select id,姓名,操作,时间,row_number() over(partiton by 姓名 order by 时间 desc) rn
from tb_name
where 姓名=?) a
where a.rn=1
from (select id,
姓名,
操作,
时间,
row_number() over(partiton by 姓名 order by 时间 desc) rn
from table
where 时间 between XXX and YYY) a
where a.rn = 1
from tb where 时间 in(select max(时间) from tb where 时间>=dt and 时间<=dt2 group by 姓名)
from tb t1 where t1.时间 in
(select max(t2.时间) from tb t2. where t1.id = t2.id and t2.时间>=dt and t2.时间<=dt2 group by t2.id)