5 个解决方案
#1
大家帮帮忙,在线等
#2
SQL> select first_name, hire_date from empl;
FIRST_NAME HIRE_DATE
-------------------- -----------
Steven 1987-6-17
Neena 1989-9-21
Lex 1993-1-13
Alexander 1990-1-3
Bruce 1991-5-21
David 1997-6-25
Valli 1998-2-5
Diana 1999-2-7
Nancy 1994-8-17
Daniel 1994-8-16
10 rows selected
SQL> select first_name,hire_date from empl where hire_date = (select max(hire_date) from empl );
FIRST_NAME HIRE_DATE
-------------------- -----------
Diana 1999-2-7
SQL>
FIRST_NAME HIRE_DATE
-------------------- -----------
Steven 1987-6-17
Neena 1989-9-21
Lex 1993-1-13
Alexander 1990-1-3
Bruce 1991-5-21
David 1997-6-25
Valli 1998-2-5
Diana 1999-2-7
Nancy 1994-8-17
Daniel 1994-8-16
10 rows selected
SQL> select first_name,hire_date from empl where hire_date = (select max(hire_date) from empl );
FIRST_NAME HIRE_DATE
-------------------- -----------
Diana 1999-2-7
SQL>
#3
谢谢上面的大哥
#4
select first_name, hire_date from
(
select first_name
, hire_date
,row_number() over (order by hire_date desc) as id
from empl
) a where id = 1;
(
select first_name
, hire_date
,row_number() over (order by hire_date desc) as id
from empl
) a where id = 1;
#5
select x.first_name, x.hire_date
from (select first_name, hire_date
from empl
order by hire_date desc) x
where rownum < 2
from (select first_name, hire_date
from empl
order by hire_date desc) x
where rownum < 2
#1
大家帮帮忙,在线等
#2
SQL> select first_name, hire_date from empl;
FIRST_NAME HIRE_DATE
-------------------- -----------
Steven 1987-6-17
Neena 1989-9-21
Lex 1993-1-13
Alexander 1990-1-3
Bruce 1991-5-21
David 1997-6-25
Valli 1998-2-5
Diana 1999-2-7
Nancy 1994-8-17
Daniel 1994-8-16
10 rows selected
SQL> select first_name,hire_date from empl where hire_date = (select max(hire_date) from empl );
FIRST_NAME HIRE_DATE
-------------------- -----------
Diana 1999-2-7
SQL>
FIRST_NAME HIRE_DATE
-------------------- -----------
Steven 1987-6-17
Neena 1989-9-21
Lex 1993-1-13
Alexander 1990-1-3
Bruce 1991-5-21
David 1997-6-25
Valli 1998-2-5
Diana 1999-2-7
Nancy 1994-8-17
Daniel 1994-8-16
10 rows selected
SQL> select first_name,hire_date from empl where hire_date = (select max(hire_date) from empl );
FIRST_NAME HIRE_DATE
-------------------- -----------
Diana 1999-2-7
SQL>
#3
谢谢上面的大哥
#4
select first_name, hire_date from
(
select first_name
, hire_date
,row_number() over (order by hire_date desc) as id
from empl
) a where id = 1;
(
select first_name
, hire_date
,row_number() over (order by hire_date desc) as id
from empl
) a where id = 1;
#5
select x.first_name, x.hire_date
from (select first_name, hire_date
from empl
order by hire_date desc) x
where rownum < 2
from (select first_name, hire_date
from empl
order by hire_date desc) x
where rownum < 2