oracle中如何取时间最晚的那笔数据?
表名:test
表数据如下:
部门 姓名 入职时间
A jack 2010-1-29
A K 2010-1-28
B mike 2010-1-27
B L 2010-1-26
想取出每个部门入职时间最晚的那笔数据该如何取?
结果如下:
部门 姓名 入职时间
A jack 2010-1-29
B mike 2010-1-27
SQL code:
SELECT 部门,姓名, MAX(入职时间) from test GROUP BY 部门,姓名
select * from test t
where not exists(
select 1 from test where 部门=t.部门 and 入职时间>t.入职时间)
SQL code:
select * from test where 入职时间 in
(
select max(入职时间) from test
)
楼上的3位都是正解!
最后一个不对吧。。。。。。
第二个。。可以解释下不,有点看不懂啊。。。
的确是有问题....
SQL code
Code highlighting produced by Actipro CodeHighlight
相关问答:
exp user/password@dbname file=c:\table.dmp tables=jbitaku,jbitakum grants=y
然後按回車鍵 說明: user/password@dbname 分別表示用戶名,密碼和服務名 f ......
在执行包的时候引用oracle spatial空间函数出错,出错情况如下
Errors in file
/user/oracle/app/oracle/admin/grid/udump/grid1_ora_143768.trc: ORA-29902:
error in executing ODCIIndexStart() routine ORA-0 ......
各位大哥,帮个忙。
下个Oracle for vista 版本的安装试试
10G和11G的
http://www.oracle.com/technology/software/products/database/index.html
------------------------------------------- ......
eclipse 3.3启动web工程,要连接oracle9i数据库报
严重: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12518, TNS:listener could not hand off cli ......
我有两个表(A表和B表),机构完全相同:A 表建立触发器
当insert into A(id,name) values('1','zhangsan'); 我只想将name=zhangsan的时候将insert语句插入到B表中而A表不执行操作这个触发器应该怎么实现呢?
如: ......