SELECT machine_name, login, Count(login) AS CountOfLogin 
FROM login_history
WHERE ROWNUM < 4
group by machine_name, login
order by count(login) desc;


>>> [EMAIL PROTECTED] 05/04/01 01:25PM >>>
Q: how can you specify with a select statement how many rows are given as a
result? I would only like to get the first three lines.....

here is what I have....


1  SELECT machine_name, login, Count(login) AS CountOfLogin FROM
login_history
  2  group by machine_name, login
  3* order by count(login) desc
  4  ;

MACHINE_NAME     LOGIN      COUNTOFLOGIN
---------------- ---------- ------------
mocha            Jeff                  3
reeses           Paul                  3
spice            Tamara                3
mocha            Rudy                  2
reeses           Jeff                  1
reeses           Ravie                 1
reeses           Tonya                 1
spice            Rudy                  1

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com 
-- 
Author: MKirk
  INET: [EMAIL PROTECTED] 

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: William Beilstein
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to