10 laksh records and need to find out the top5 salary
Hi,
I have emp table with 10 laksh records and need to find out the top5 salary.I formed the below mentioned query,
SELECT ROWNUM,SAL,EMPNO,ENAME,DEPTNO FROM(SELECT ENAME,EMPNO,
DEPTNO,SAL FROM EMP ORDER BY SAL DESC) WHERE ROWNUM<=3 AND SAL IS NOT NULL;
i would like tune this query or anyother new qeury find out top5 salary.
By
Siva
kn_sivaraman wrote:
Hi,
I have emp table with 10 laksh records and need to find out the top5 salary.I formed the below mentioned query,
SELECT ROWNUM,SAL,EMPNO,ENAME,DEPTNO FROM(SELECT ENAME,EMPNO,
DEPTNO,SAL FROM EMP ORDER BY SAL DESC) WHERE ROWNUM<=3 AND SAL IS NOT NULL;
i would like tune this query or anyother new qeury find out top5 salary.
By
SivaWhy do you need to Tune? What do you need to tune?
What is the execution time of the query? What is the explain plan?
Moreover, in an International forum, refrain from using Locals. 10 Lakhs = 1 Million.
Do provide the above details to determine if your query needs tuning?
Below is a correct version of Top N query. Untested for your example. Please do modify according to your needs.
SELECT ROWNUM,
SAL,
EMPNO,
ENAME,
DEPTNO
FROM
(SELECT ENAME,EMPNO, DEPTNO,SAL, dense_rank() over(order by sal desc nulls last) dr
FROM EMP ORDER BY SAL DESC
) a
WHERE a.dr <= 5;Regards,
P.
Similar Messages
-
Need to find out the number of Master data records transfered to the BW
Hi,
We need to find out the number of Master data (example -0MAT_PLANT_ATTR) records to be transfered to BW side. This is a delta extract. We are preparing test scripts to check the master data extract ( full & delta) from ECC6 TO BI 7.0..
Advance Thanks.Hi,
Goto RSA3 and run that master data extractor in D mode if you want to know the number of records in delta and in F mode if you want to know the Full volume. But make sure that you set data records/calls and the display extr calls numbers so that you get the total number of records.
The other option is goto the master data source table and look at the number of records in that table. That'll give you an idea of the total number of records in the table.
One other option is to goto RSA7 , select the delta datasource and hit the display button. You'll get to know the number of entries in the delta queue that way as well.
Cheers,
Kedar -
I have an email account through yahoo. I am having trouble setting it upon my iPhone and can't receive or send emails!!!! I contacted Rogers and they said I need to find out the host name of the incoming server, in other words yahoos host name. Help!!
Yahoo's servers are notoriously unreliable. Use the "Yahoo" account type when setting it up. If it doesn't work, and you are positive the credentials are correct, wait a while and try again.
While you're waiting, set up a free gmail or iCloud email account. -
Need to find out the queries which did not executed in 2014
Hi All,
I need to find out the queries which start from YY and did not executed in 2014, earlier we used to find out by looking into the technical content cube 0TCT_C02 but now its giving dump as number of queries increases. I tried to find out using table RSZCOMPDIR but not able to trace it exactly. Please suggest some alternative solution to find out the queries which did not execute in 2014 so that we can delete it.
Thanks,
Asim.Hi,
RSDDSTAT_OLAP : This is the table which contains query execution details
CALDAY field in that table gives you query execution date
OBJNAM gives the query name
As you said RSZCOMPDIR gives list of all queries. doing a lookup between these tables will identify the queris which are not executed in particular period.
-Sriram -
Need to find out the account group given the accounting document number
I am new to SAP. Please help.
Need to find out the account group given the accounting document number?If you are asking about account assignment group then that can be seen in billing document -> Header -> Accounting Data.
-
Need to find out the traffic coming into and going out of ALSB
Hello,
I would like to know if there is a way to find out the traffic coming into and going out of ALSB (Number of Messages). Please let me know if i am not clear.
Thanks,
VarunI would like to know if there is a way to find out the traffic coming into and going out of ALSB (Number of Messages). Please let me know if i am not clear.There are two points. If you want to get aggregate traffic for all end-points in OSB, then out of box is not possible.It can be arrived at using monitoring capabilities.
http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/operations/monitoring.html
If you are looking at the traffic at end-point level, then it is available when monitoring is enabled.
Cheer
Manoj -
I need to find out the list of outbound made it to the vendor
I need to find out if the attached list of outbound made it to the vendor.
and i have list of all IDOC numbers that i need to check. Could you please assist? how to check?
Please do needful.
Thanks in advance.
Regards,
PIneeder.Hi,
If you want to check it in XI/PI check first:
- in the abap stack transaction:
- sxmb_moni and filter for your sending system and idoc type
or
- idx5 fill in the date when the idoc was sent and the idoc number from the sending system and through double-clicking you will get to the same message as in sxmb_moni
- in the runtime workbench (only if the communication with the partner is done via a java based adapter (all except xi,http and idoc) go to the runtime workbench and then click on message monitoring and filter for your messages. If the status there is succesfull then you can safely assume that the message was delivered to the partner. Note: it sometimes happens that a PI server also has one or more decentral adapter engines. In this case you need to check if your communication channel is deployed on any of them (you can check that in the Integration Builder) and then select the corresponding one in the Runtime workbench -> Message Monitoring -> Message from Component.
Hope this helps,
Horia -
Help downloaded game and need to find out how to add to iPod
i downloaded the new ipod mini golf and i cant seem to find out how to add it to the thing please help.
Welcome to Apple Discussions!
1) Connect your iPod to the computer.
2) Click the iPod in iTunes under Source (to the left).
3) Click the Games tab.
4) Select Sync all games
5) Choose File --> Sync "iPod" to add the game
You need to have a 5G iPod with video to play the game
btabz -
How do I find my iPad serial #? I have left it on an airplane and need the number for the report. I do not have a computer but do have an I phone
Try logging in to Apple product registration and if you registered the iPad it should be there with the serial number. If that does not work you can try calling your country support number from http://support.apple.com/kb/HE57 and see if they can help get the serial number...of course they will want proof such as an Apple ID and password.
-
Need to Find out the Print Program
Dear All,
I am designing a layout for the Printed stationary (cheque Print). I am stuck in a place where in i am not able to find the Print Program.
Can anybody please help me.
With rgds
Ranjith SinghHi Ranjit,
USe TNAPR table to check for the print programs.
Alternatively use NACE transaction and select the Application relavant to you and check out the output types and their settings.
Cheers
VJ
Message was edited by: Vijayendra Rao -
Need to find out the usage of report
Hi,
I have published few reports in infoview. Need to find who all are accessing these reports & when.
Can somebody help me?
ThanksI would recommend to take a look at the admin guide
http://help.sap.com/businessobject/product_guides/boexir31SP3/en/xi31_sp3_bip_admin_en.pdf
Check the Managing auditing and Auditing reports sections.
Regards,
Stratos -
I NEED TO FIND OUT THE GENERATION OF MY IPOD TOUCH
I AM TRYING TO PURCHASE AN IPOD TOUCH, HOWEVER, I WANT TO MAKE SURE IT IS A 4TH GENERATION...I HAVE THE SERIAL NUMBER...CAN I FIND OUT USING THAT?
Identifying iPod models
Please turn off your caps lock.
All caps indicates shouting, is considered rude and is difficult to read. -
Need to find out the Cost center for one location, one cost center
/* Formatted on 2015/02/27 08:34:29 AM (QP5 v5.215.12089.38647) */
SELECT DISTINCT cost_centre
-- INTO l_cost_center
FROM ( SELECT DISTINCT --pap.name position,
haou.organization_id org_id,
haou.LOCATION_ID,
pcak.concatenated_segments cost_centre
FROM -- per_all_positions pap
per_all_assignments_f pasf,
hr_all_organization_units haou,
pay_cost_allocation_keyflex pcak,
HR_LOCATIONS_ALL_TL l
WHERE pasf.organization_id = haou.organization_id
AND haou.cost_allocation_keyflex_id =
pcak.cost_allocation_keyflex_id
-- AND pasf.position_id=pap.position_id
-- and pap.primary_position_flag = 'Y'
-- AND haou.business_group_id=101
AND pasf.LOCATION_ID = l.LOCATION_ID
and l.language='US'
-- and l.organization_id=haou.organization_id
GROUP BY haou.organization_id,
haou.LOCATION_ID,
pcak.concatenated_segments --pcak.segment2
) Pos_cc
WHERE pos_cc.location_id =
(SELECT DISTINCT location_id
FROM hr_locations_all
WHERE location_code = 'Pinelands' --i.branch_name
AND ROWNUM = 1)
Please help me with this query, I am new to HRMS modules. Need to understand that why for one location it is coming multiple cost center.
Please help me understand this. I need to pass one value in INTO of this query.
Thanks,
Syed HasanCost centre is stored at the Organization level.
And many Organizations can have the same location, so for a location you can have different cost code combinations.
If you need just one segment(location segment), then it could be unique.
So , instead of pcak.concatenated_segments cost_centre use pcak.segmentX (X could be 1,2,3 etc based on your flexfield definition) -
Need to find out the amps drawn on charging battery.
I am designing a off grid solar system and need the amps drawn while charging battery, also amps drawn while pluged in during use. Thanks
I do not understand the distinction between "while charging battery" and "in use" but the 85W charging adapter's input current is rated 1.5 A.
-
Need to find out the hierarchy information of a particular Menu
I have written a query using "select ... start with initial-condition connect by recurse-condition" syntax to get the Hierarchical information for a prticular menu.
select count(SUB_MENU_ID) from FND_MENU_ENTRIES_VL
start with MENU_ID = 76580
and SUB_MENU_ID is not null
connect by prior menu_id=sub_menu_id
O/P: *16*
Now if I write the query to get the number of record manually upto level 2 thats gives me the output as *36*.
select distinct(SUB_MENU_ID) from FND_MENU_ENTRIES_VL
where MENU_ID = 76580
and SUB_MENU_ID is not null
union
select distinct(SUB_MENU_ID) from FND_MENU_ENTRIES_VL where MENU_ID in(
select distinct(SUB_MENU_ID) from FND_MENU_ENTRIES_VL where MENU_ID = 76580
and SUB_MENU_ID is not null)
Please let know whats wrong with the first query.Hi,
Whenever you have a question, please post CREATE TABLE and INSERT statements for your sample data, so that the people who want to help you can re-create the problem and test their ideas. From looking at your posting:
981094 wrote:
SUB_MENU_ID MENU_ID
67723 72570
67723 72581
77139
76580It's impossible to know even which columns are NULL.
Read the forum FAQ {message:id=9360002} again, especially the part about sample data (section 7) and the part on \ tags (section 9).
If you want to restrict a CONNECT BY query to LEVEL<x, then just include that condition in the CONNECT BY clause:SELECT COUNT (sub_menu_id)
FROM fnd_menu_entries_vl
START WITH menu_id = 76580
AND sub_menu_id IS NOT NULL
CONNECT BY PRIOR menu_id = sub_menu_id
AND LEVEL <= 2
You could also put that condition in a WHERE clause, to discard the rows after they were found. But it's more efficient to put conditions like that in the CONNECT BY clause, so the unwanted rows are not found in the first place.
Your CONNECT BY query does not consider whether the sub_menu_ids found were distinct or not. If you're trying to find an alternative query that does not use CONNECT BY, why are you including DISTINCT when that wasn't part of the original query?
In the UNION query you posted, the first branch (before the keyword UNION) corresponds to LEVEL=1 of the CONNECT BY query, but the second branch (after the keyword UNION) corresponds to what would be LEVEL=2 if the CONNECT BY condition was
"menu_id = PRIOR sub_menu_id", but for your CONNECT BY condition:
"PRIOR menu_id = sub_menu_id", a corresponding UNION query would be:SELECT sub_menu_id
FROM fnd_menu_entries_vl
WHERE menu_id = 76580
AND sub_menu_id IS NOT NULL
UNION ALL
SELECT sub_menu_id
FROM fnd_menu_entries_vl
WHERE sub_menu_id IN (
SELECT menu_id -- DISTINCT not needed in an IN sub-query
FROM fnd_menu_entries_vl
WHERE menu_id = 76580
AND sub_menu_id IS NOT NULL
Depending on what results you want, you may or may not need SELECT *DISTINCT* outside of the IN-subquery, but you never need DISTINCT in the IN-subquery.
Maybe you are looking for
-
Calling a function inside a symbol?
Hi there, I'm one of those flash-devs that are trying to get Edge Animate to do what I usually do in Flash, so I might be doing this the wrong way, but I've got a symbol with a function "inside" on my stage, and I wanna call that function from the st
-
How can I get the query name in webitem method ?
Hello, I have defined a new web item but I can't retrieved parameter of my webitem in the RENDER method for instance. I have declared a parameter in the RSRRENDERATR table like this : REN_NAME : MY_WEBITEM ATR_NAME : MY_PARAM ATR TYP : TEXT CHR MAX L
-
STMS problem ( import status - import runnig does not change)
I have the same problem like this: While Transporting request in our production server the status of request from import running (truck sign) does not change. But the effect of the request is seen in the production but status does not change. see :Re
-
My message is missing after a small hang when I use group SMS app. After this incident I didt sync with itune..... So what I want to do to restore the message. More than 600 messages I had .... Now it's fully empty
-
What's going on here? Terminal screen pops up after installing Mountain lion.
I installed mountain lion yesterday! all looked like it was working well. Just now I rebooted my iMac. The first thing I see on my computer is that it booted up in terminal mode! I have white lettering on black background with a lot of lines of text.