0

I run:

select aname, APERCENT from AGENTS order by APERCENT DESC;

and I get this result:

ANAME APERCENT

john    7

jane    6

teddy   6

bob     6

allen   5

airon   5

Now I want to pick up first column so I add rownum=1.

select aname, APERCENT from AGENTS order by APERCENT DESC where ROWNUM=1;

But SQL command not properly ended, and I want to fix it. What should I do?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
sang wun
  • 3
  • 3

1 Answers1

0

You should add rownum=1 AFTER ordering. So it will be

select *
from
(
select aname, APERCENT 
from AGENTS 
order by APERCENT DESC 
)
where ROWNUM=1;
Tatiana
  • 1,489
  • 10
  • 19