TOP 3 Records
hi,
i have a table CATEGORY.There are two Column CATEGORY_ID and CATEGORY_NAME.
if i have Multiple record corresponding CATEGORY_ID.
i want to display only top 3 Record like.
1---A
1---B
1---C
2---O
2---E
2----F
3---JJ
3---YU
3---LK
How can i display top three Record in Report.i have no PK In taht table.
Thanks
try:
select CATEGORY_ID,
CATEGORY_name from
select
CATEGORY_ID,
CATEGORY_name,
row_number() over (partition by CATEGORY_ID order by CATEGORY_name) rn
from
CATEGORY
where
rn <= 3
also check
http://nimishgarg.blogspot.com/2010/02/oracle-sql-rank-denserank-rownumber.html
Nimish Garg
http://nimishgarg.blogspot.com/
Similar Messages
-
Selecting Top N records in a table using a slider or drop down list
Hi Experts,
I have a query that displays 1000 records ( say) in VC iview.
Can i have a drop down list in the variable form to control the number of records displayed in the output table by the user .
or can i have a horizaontal slider ( Min value is 2 -max 1000) to display the number of records in the output table selected by the horizaontal slider.
basically iam having a requirement to give the user the capability to select the Top N records of the output table...where the user enters the N value in Drop downlist of variable form or user slides the N value using Horizontal slider
Thnaks
P.NavakanthHi
Yes it is possible. First you need to create 'Condition' in BEx query where you have to create 'TOP N' & 'N' should be a variable input. Then you will get this in 'Variable Screen' of a query. In VC for this same variable you can use slider. Use 'Select' function in the 'Action' of the slider & pass it to require table/graph.
Try this, this will give you the required result.
Regards
Sandeep -
How to find out top 10 records from the R/3 using Java code (WD Program)
Hi Experts,
I have used Java Web Dynpro program to fetch records from the backend. Following code helps me and fetches record. As per the customer reqirement, we have to fetch only top 10 records (Actual Cost) from the backend. So I have to modify the Java code. How I can do so? Please help.
wdContext.nodeGraphData().invalidate();
IPublicCostcnt.IGraphDataElement categoryElement;
for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
categoryElement = wdContext.createGraphDataElement();
categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
wdContext.nodeGraphData().addElement(categoryElement);
Regards,
GaryDear SDN Users,
This is how I resolved the issue.
1) Requested ABAPer to provide me sorted data. The data has been sorted in descending order of actual_cost.
2) After that I used following code. This resolved the issue.
if (wdContext.nodeItab_Final1().size()>10){
IPublicCostcnt.IGraphDataElement categoryElement;
for (int i = 0; i < 10; i++) {
categoryElement = wdContext.createGraphDataElement();
categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
wdContext.nodeGraphData().addElement(categoryElement);
if (wdContext.nodeItab_Final1().size()<=10){
if (wdContext.nodeItab_Final1().size()>0){
IPublicCostcnt.IGraphDataElement categoryElement;
for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
categoryElement = wdContext.createGraphDataElement();
categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
wdContext.nodeGraphData().addElement(categoryElement);
Regards,
Gary -
How to Get Top 10 records using SQL select statement.
:-) Hiee E'body,
I want to generate a sql report in which I only want the top 10 records based on the numeric value of a column.
For Example,
To generate a Location Wise, Employee Wise Years of Service Report.
Here I need the Top 10 Employees according to their No. of Years of Service for all the existing locations using a single query.
eg.
Location Emp No. YOS
India - 22 30
212 28
819 24 ...
US 123 40
312 33
90 33
144 30 ...
UK 77 20
79 20
331 18
109 16 ...
Every Location should display their respective Top 10 Employees
regarding their No. of Years of Service.
Please let me the know the solution to this.
Have a nice day.
Thanking You,
Vivek Kapoor.For example if the table contained (India rows only shown) :
India 202 30
India 212 28
India 819 24
India 820 24
India 900 20
India 920 18
India 922 17
India 925 16
India 926 15
India 927 14
India 928 13
India 929 13
India 930 12
do you want to see
India 202 30
India 212 28
India 819 24
India 820 24
India 900 20
India 920 18
India 922 17
India 925 16
India 926 15
India 927 14
or
India 202 30
India 212 28
India 819 24
India 820 24
India 900 20
India 920 18
India 922 17
India 925 16
India 926 15
India 927 14
India 928 13
India 929 13
Also if the India rows were
India 202 30
India 212 30
India 819 30
India 820 30
India 900 30
India 920 30
India 922 30
India 925 30
India 926 30
India 927 30
India 928 30
India 929 30
do you want to see
India 202 30
India 212 30
India 819 30
India 820 30
India 900 30
India 920 30
India 922 30
India 925 30
India 926 30
India 927 30
or
India 202 30
India 212 30
India 819 30
India 820 30
India 900 30
India 920 30
India 922 30
India 925 30
India 926 30
India 927 30
India 928 30
India 929 30
Please clarify.
Thanks,
Partha -
How can I use SQL to select the top 10 records (do not use cursor)
... not only that but the order by and rownum check cannot be done in the same select. You need an in-line view.
select * from
(select * from table
order by whatever)
where rownum < 11
BEWARE: Incorrect use of rownum (which is very common) often returns the correct result by accident, but you cannot guarantee that the accident will continue to happen. -
How to order/get top 10 records of Business Object
Hi Guys,
I need some help here.
Im trying to find out how should I go about ordering my return results by .findByMultipleParameters.
Is there a simple method to also get eg. top 30 records after sorting the results?
There are some new class - OrderBy, Paging in 7.11 (EhP1 SP02) but I'm not on this version yet.
Thanks all for your help in advance.
Thanks.Hello Bertina!
I think you talk about it:
List<QueryFilter> list = new ArrayList<QueryFilter>();
list.add(QueryFilterFactory.createFilter("products.name", Condition.EQ, "Pen"));
list.add(QueryFilterFactory.createFilter("products.code", Condition.EQ, 30));
OrderBy orderBy = new OrderBy("products.name");
Paging paging = new Paging(10);
myService.findByMultipleParameters(lista, orderBy , paging, "");
A sample code, that is work fine for you.
Regards, Ronaldo.
Edited by: Ronaldo Rampelotti on Jun 18, 2009 10:36 PM -
Layout and Pagination... Limiting my data to top 500 records
Hi,
My report is based on SQL, it's displaying only top 500 records... May I know how to fix it...?
I've tried different options under Report attibutes -> Layout and Pagination but no success yet
ThanksTry closing OAE and the application if running.. Seems like the changes don't take effect until you come back into OAE... At least that is what mine does.
-
To display top 7 records in the dashboard
hai,
while iam creating the a report with top 7 records to be displayed but, it dispalys only 5.
plz let me know the correct way to approach it.
thanks in advance.yah! the data is displayed by using "is in Top" function as a filter.
7 records are displayed, without the year column.
thanks we found the answer. we think that only year column, which is displayed in that table view made this issue.
thanks for response....
thanks kishore..... sorry to disturb ur time. -
how we can select top five records of sal column from emp table.
http://forums.oracle.com/forums/ann.jspa?annID=599
PL/SQL -
Changing default Top 200 records
Hi and thank you for your help...
I don't seem to understand the logic of defaulting to the " Edit top 200 records" ...Can the default "Edit Top 200 Rows" be changed to let's say top 2000?you can.
Change the value in below setting
This is accessed from top menu Tools -> Options
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
I can get the top ten records with this command.
select amt,rank() over (order by qater desc) as qtr
from table1 where rownum<=10;
Now I want to get the sum(amt) in similar query and it is giving problem. How can I do it?
Thank You.I don't think that query does what you think it does. It's a side effect of the analytic window function implementation that you are relying on there. You should really change that to a subquery. When you do that, getting the sum is more obvious ...
select amt, qtr, sum(amt) over ()
from (
select amt, rank() over (order by qater desc) as qtr
from table1)
where qtr <= 10 -
Hi Friends,
i've a prompt in my dashbord, based on the prompt the report values will display right,
my requirement is that i want display only top 5 records,
how will you do thatHi
Create a prompt with a column and assign presentation variable in it.
In report for measure give the function as topN in edit formula.The syntax is shown as
TOPN(expr, integer)
If u want top 5 then TOPN(Measure Column,5) give filter to this column with presenntation variable
We can do it with 'rank' function also like this
Rank(Measure column)
Otherwise,Use TopN filter in the report.But it shows 5records statically.For this there is no need of prompt.
Thanks
Don -
hi all ,
good morning .
i have the requirement to get the top 5 to top 10 records in sap bi reporting .
plz some body respond .
thanks in advance .
regards ,
srinivashi Srinivas,
based on what Key figure you wanted to find the top 5 characterstics.
like if you wanted to find the top 5 customers who has made more sales value. then use the condition on the key figure 'sales value'.
request you to Please be clear on your requirement.
ok same with vendors also.
Create a condition, new condition - Give the key figure - operator (=, > or <) - values. you can give a constant value or you can create variable also here.
in the next tab, you can assign this condition applicable on which level of the drill down of the characteristics.
Edited by: Sreekanth S on May 8, 2009 10:35 AM -
Return the top 3 records only.
Hello !
I wonder if someone could help me with a question.
I have some SQL
SELECT * FROM JOBS ORDER BY SALARY
Now I only want to return the top three records, in SQL Server I would do the following.
SELECT TOP 3 FROM JOBS ORDER BY SALARY
Is there anyway to return just the top records in this maner in Oracle.
Many THanksselect * from
(select dense_rank() over (order by sal desc) r, emp.* from emp)
where r<=3
R EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
1 7839 KING PRESIDENT 17.11.1981 00:00:00 5000 10
2 7788 SCOTT ANALYST 7566 19.04.1987 00:00:00 3000 20
2 7902 FORD ANALYST 7566 03.12.1981 00:00:00 3000 20
3 7566 JONES MANAGER 7839 02.04.1981 00:00:00 2975 20 -
Trying to get the top N records from a query.
Hello,
Im trying to get the top N records of a random query. I've been looking for a decent solution for a while now and the 2 solutions I've come across are:
select *
from (select * from qrs_klantgroepen order by code) a
where rownum < 10
ORA-00907: missing right parenthesis
The query works when I remove the order clause from the subquery, but it's mandatory to get the results I need.
The next solution:
select *
from (select code, row_number() over (order by code) from qrs_klantgroepen) a
where rownum < 10
ORA-00923: FROM keyword not found where expected
Apparently the construct used here isn't supported by my oracle version.
I'm using oracle Oracle8 Enterprise Edition Release 8.0.5.2.1.
Is there another way I can achieve the results I want?
Looking forward to your replies.
Frederikit must be nostalgy, but I would try something like
SQL> select * from emp e where 5>(select count(*) from emp where ename<e.ename) order by ename;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7876 ADAMS CLERK 7788 1987-05-23_00:00:00 1100 20
7499 ALLEN SALESMAN 7698 1981-02-20_00:00:00 1600 300 30
7698 BLAKE MANAGER 7839 1981-05-01_00:00:00 2850 30
7782 CLARK MANAGER 7839 1981-06-09_00:00:00 2450 10
7902 FORD ANALYST 7566 1981-12-03_00:00:00 3000 20
SQL> select * from (select * from emp order by ename) where rownum<6;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7876 ADAMS CLERK 7788 1987-05-23_00:00:00 1100 20
7499 ALLEN SALESMAN 7698 1981-02-20_00:00:00 1600 300 30
7698 BLAKE MANAGER 7839 1981-05-01_00:00:00 2850 30
7782 CLARK MANAGER 7839 1981-06-09_00:00:00 2450 10
7902 FORD ANALYST 7566 1981-12-03_00:00:00 3000 20Message was edited by:
Laurent Schneider
Maybe you are looking for
-
Pages won't sync between iPad and Macbook
I cannot get my pages to sync between iPad and Macbook. I regularly go back and forth between the two because it's easier to read/edit on iPad and easier to type/copy-paste web info on Macbook. I'm finding right now that I have done a multitude of ed
-
ORA-01017: invalid username/password; how to find out orapwd files 's pwd
Hi, gurus, I have this error after I copied primary db orapwd files over to standby instance and tried to log in sys as sysdba : ORA-01017: invalid username/password; logon denied Is this means the sys password I provided is not the one generated as
-
Error with VPRS condition type in Quotation
Hi, When go through the pricing conditions of my quotations, I see a red signal indicating error before the VPRS Condition type (Condition category G). When i do the condiotn analysis, the diagnosis read as below. "Error in quantity / value updation"
-
PC Outlook to MAIL attachment corruptions
This is a two part question: (1) When I get an email forwarded from Outlook (professional version) with embedded pictures, the pictures show up as question marks in blue boxes. WHY? How do I 'fix' MAIL so that I can see the embedded photos/graphics?
-
Standard report for Activity types in REM scenario.
Hi PP Gurus, Is there any standard report like MCRP, MCP6, MF12 in REM scenario to capture time booked for Activity types? Please revert. Thanks & Regards, Abu Arbab