select obj#, owner#, ctime from sys.obj$ o1
where obj# = (
select obj# from sys.obj$ o2
where o1.owner# = o2.owner#
and rownum = 1
-- order by ctime desc
)
but after remove commect on ORDER BY line i have error
ORA-00907 missing right parenthesis.
Can you help me to resolve this error ?
The order by must be after the closing parenthesis.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
select obj#, owner#, ctime
from
(select obj#, owner#, ctime,
max(ctime) over (partition by owner#) mct
from sys.obj$)
where ctime=mct
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
but after remove commect on ORDER BY line i have error
ORA-00907 missing right parenthesis.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
This query select first object (by ctime field) to each owner.
Problem not in -- and carrige return.
For example:
i have
obj# owner# ctime
1 0 1/1/2005
2 0 1/1/2006
3 0 1/1/2007
1 1 1/1/2005
2 1 1/1/2006
select obj#, owner#, ctime
from sys.obj$ o1
where (obj#, owner#) in (
select obj#, owner#
from (
select obj#, owner#
from sys.obj$ o2
order by o2.ctime
) x
where ROWNUM = 1
and x.owner# = o1.owner#
)
but it's very slow or this select also work but too complex
select obj#, owner#, ctime from sys.obj$ o1
where obj# = (
select obj# from (
select obj#, owner#
from sys.obj$
order by ctime) o2
where o1.owner# = o2.owner#
and rownum = 1
)
Bookmarks