如题,比如:
用户a,时间,其它字段
用户b,时间,其它字段
用户a,时间,其它字段
用户c,时间,其它字段
想取每个用户,每天时间最晚的那条记录。表中时间格式,年月日小时分秒都有。
最后结果是
用户a,时间,其它字段
用户b,时间,其它字段
用户c,时间,其它字段
谢谢
用户a,时间,其它字段
用户b,时间,其它字段
用户a,时间,其它字段
用户c,时间,其它字段
想取每个用户,每天时间最晚的那条记录。表中时间格式,年月日小时分秒都有。
最后结果是
用户a,时间,其它字段
用户b,时间,其它字段
用户c,时间,其它字段
谢谢
解决方案 »
- ORACLE数据库
- OCI里拼接的sql语句插入汉字,select出来是乱码
- 在Linux 平台下 Oracle RAC 系统的安装配置(下载)
- ORACLE出现错误警告,导致无法连接:oracle instance jh - can not allocate log , archival required
- 请问在PRO*C中如何使用sql语句??
- 请教VB中利用ADO访问远程服务器上的Oracle数据库,Connectiongstring连接字符串怎么写?全分!
- oracle中游标能定位吗?
- 游标问题
- 在Oracle中如何实现某一字段值的自增?SQL怎么写?
- 怎样可以将mysql里新增的表和数据自动增加到oracle里
- oracle存储过程动态参数如何编写及如何引用动态参数
- PLSQL块报错:违反唯一约束条件,在i>1000时不报错,这是为什么呢?
from (select t.*, row_number() over(partition by trunc(time) order by time desc) rn from t)
where rn = 1;
shiyiwan兄好久不见``
FROM test5 a
WHERE (a.username, a.time) IN
(SELECT t.username, MAX(TIME) FROM test5 t GROUP BY t.username, trunc(TIME));
from table1 a
where not exists (select 1 from table1 where 用户=a.用户 and 时间>a.时间);
tangren的回答是正解。谢谢所有回答的朋友。
十分抱歉,刚才没注意。
如果不只是从Test5里面而是从Test6、Test5里面查出字段来重新组合且time只是test6里的一个字段,该咋个处理呢