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

Home -> Community -> Mailing Lists -> Oracle-L -> question about the query..

question about the query..

From: <Srinivas_Madala_at_circuitcity.com>
Date: Wed, 05 Sep 2001 07:26:49 -0700
Message-ID: <F001.00383507.20010905073844@fatcity.com>

Hi List
I have a question regarding a SQL query I am working on. I have a table named 'tmp_scores', with a column 'rank' and other columns. Rank varies from 1 to 12. I need to get the top 10 million records based on the rank.

I have used the logic behind the following query(to get top 4 salaried employees)



select ename,job,sal from emp e
where 4 > (select count(*) from emp
                      where e.sal<sal)

order by sal;

to get my task accomplished as below:

SELECT a.customer_id,
       a.first_name,
       a.last_name,
       a.carrier_route_code,
       a.unit_designator||'|'||a.street_pre_directional||'|'||
       a.primary_street_number||'|'||a.primary_street_name||'|'||
       a.street_post_directional||'|'||a.secondary_address_number||'|'||
       a.secondary_address_name "Street",
       city,
       a.state_code,
       a.postal_code,
       a.postal_code_extension,
       a.combined_score_demi_decil_rank

FROM tmp_stg_van_customer_details a
WHERE 10000000 > = (SELECT count(*) FROM
                      tmp_stg_van_customer_details
                      WHERE a.combined_score_demi_decil_rank <
combined_score_demi_decil_rank)
ORDER BY combined_score_demi_decil_rank;

I have issued the query and it has been running for the last three days without giving any error.
I am not able to conclude what to do.
Any help is highly appreciated.

Thanks in advance.
srinivas

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Srinivas_Madala_at_circuitcity.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 Wed Sep 05 2001 - 09:26:49 CDT

Original text of this message

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