Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How can I cut off a query after 3 lines?

Re: How can I cut off a query after 3 lines?

From: William Beilstein <BeilstWH_at_obg.com>
Date: Fri, 04 May 2001 11:15:28 -0700
Message-ID: <F001.002F9A73.20010504101057@fatcity.com>

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

>>> mkirk_at_hot.ee 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: mkirk_at_hot.ee 

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: ListGuru_at_fatcity.com (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: BeilstWH_at_obg.com

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: ListGuru_at_fatcity.com (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).
Received on Fri May 04 2001 - 13:15:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US