SQL query to sorting top 20 customers
I want to query my Oracle 9i DB to get a listing of the TOP 20 customers based on invoiceamount. I further want to group by cutomertype and region
Is the following query correct ?
select distinct branch, region , partyname, customertype , qnty , invoiceamount from detailed_sales where rownum < 20
order by invoiceamount desc
Thanks for help ..
you can use analytical functions
select distinct branch, region , partyname,
customertype , qnty , invoiceamount,rn from (select
distinct branch, region , partyname, customertype ,
qnty , invoiceamount ,dense_rank()over(order by
invoiceamount desc) rn detailed_sales) where rn <= 20;Thanks for the reply .. This query is giving a error
ORA-00923: FROM keyword not found where expected
Similar Messages
-
SQL query to find top 5 users having more rows/data in table
Dear experts,
OS = HP-UX
Database = Oracle 9.2.0.8
AC users = 600
Ex:-
select * from all_users where username like 'AC%';
AC_1
AC_2
AC_3
AC_4
AC_5
AC_6
AC_.
AC_.
AC_.
AC_600
Each AC user having same tables INCOMING, OUTGOING
Now i need to find top 5 users having more rows/data in INCOMING , OUTGOING tables. I tried this:
SQL>conn AC_1/pwd
select 'select count(*) from '||table_name||';' from user_tables;
But i get max counts info only for this AC_1 user , however, i need top 5 users having more rows/max counts query.
Thank you,source : oracle forums
May be , this one.. not tested though.
Before doing this you need to have select_catalog_role
WITH tmp
AS (SELECT owner,
table_name,
TO_NUMBER (
EXTRACTVALUE (
xmltype (
DBMS_XMLGEN.getxml (
'select /*+ PARALLEL*/ count(*) c from '
|| table_name)),
'/ROWSET/ROW/C'))
Cnt
FROM dba_tables
WHERE 1 = 1 AND table_name IN ('INCOMING', 'OUTGOING')),
tmp1
AS (SELECT a.*,
MAX (cnt)
OVER (PARTITION BY a.table_name ORDER BY a.cnt DESC)
maxcnt
FROM tmp a)
SELECT DISTINCT a.*
FROM tmp a, tmp1 b
WHERE a.cnt = b.maxcnt AND a.table_name = b.table_name; -
Hello,
i have some problem with sql query. Could somebody help me, pleas?
I have this query in universe:
left('00', 2 - length(cast(datepart(week,VISION.OPOBJHISTJEDN.DATUM ) as varchar))) || datepart(week, VISION.OPOBJHISTJEDN.DATUM) ||
') '||dateformat(VISION.OPOBJHISTJEDN.DATUM-cast(dateformat(VISION.OPOBJHISTJEDN.DATUM,'d') as int)+2, 'dd.mm.yyyy')
and I would like to line up the week descending, order by doesnt work, its some function, which i can use?
Thank you for your answer
MarikaThe problem was:
Hello all,
i solve this problem:
i have time period: dates, months, quater, year and I would like to do a week. I know, that I can do it with functions week.
But if I do the dimension week with the function week, I cant have the drill filter on and I need the week in the drill filter in drillbar at the top the report.
Pleas could somebody help me?
Thank you very much and have a nice day.
Marika
So I had to solve the problem in the universe, because I would like to use this week+days together in one drillfilter.
When I do the sql query, it sorts asc, but I would like to sort it desc.
Thank you for your help.
Marika -
Column sort gives "failed to parse SQL query"
Hi folks,
I have a page with a chart and 5 reports. All report columns are sortable.
When I first navigate to the page from a menu, the chart and all reports display correctly. Given certain query criteria, reports 2 and 4 correctly return no data, and show my polite 'no data found' message.
If I sort report 1 or 3 or 5 by clicking a column heading, the chart and reports 1, 3 and 5 display correctly, but in report regions 2 and 4 I then get
failed to parse SQL query:
ORA-06502: PL/SQL: numeric or value error: NULL index table key valueThese errors can be cleared by navigating to the page again from a menu.
What's wrong? How can I fix it?
I'm at 1.6.0.00.87, db 10.1.0.3.0.
All ideas gratefully received.
Thanks
John DOK, I now have a workspace.
I recreated the problem using page 1 of the Sample Application (app 15027).
1 - Copy region "My Top Orders" to "My Top Orders 2" on page 1 (same display point, column 2).
2 - Edit the SQL of "My Top Orders 2" to remove the ORDER BY clause.
3 - Edit the columns of "My Top Orders 2" to make all columns other than ORDER_ID sortable.
4 - Copy region "My Top Orders 2" to "My Top Orders 3" on page 1 (same display point, column 2)..
5 - Run page 1
6 - Click a column heading on "My Top Orders 2" and I got "failed to parse..." on "My Top Orders 3".
BUT it's intermittent. Navigate away from page 1 then return, and you may find the error doesn't recur.
So, what's up Doc?
Many thanks,
John -
hi Experts,
while running SQL Query i am getting an error as
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
T2.LineText
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,T2.LineText
how to resolve the issueDear Meghanath,
Please use the following query, Hope your purpose will serve.
select T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
CAST(T2.LineText as nvarchar (MAX))[LineText]
from OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
QUT10 T2 ON T1.DocEntry = T2.DocEntry --where T1.DocEntry='590'
group by T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
,CAST(T2.LineText as nvarchar (MAX))
Regards,
Amit -
SQL Query for TOP 10 Average CPU
Have a SCOM Report request for a line graph showing top 10 average CPU for a group of servers. I have a query that will show all of the servers in a group for the last day, with the average CPU by hour. How can I extend the SQL query to only select the TOP
10 average CPU from the group? Here is the Query I have:
SELECT
vPerf.DateTime,
vPerf.SampleCount,
cast(vPerf.AverageValue as numeric(10,2)) as AverageCPU,
vPerformanceRuleInstance.InstanceName,
vManagedEntity.Path,
vPerformanceRule.ObjectName,
vPerformanceRule.CounterName
FROM Perf.vPerfHourly AS vPerf INNER JOIN
vPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRowId = vPerf.PerformanceRuleInstanceRowId INNER JOIN
vManagedEntity ON vPerf.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN
vPerformanceRule ON vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
WHERE
vPerf.DateTime >= DATEADD(Day, -1, GetDate())
AND vPerformanceRule.ObjectName like '%Processor Information%'
AND vPerformanceRuleInstance.InstanceName = '_Total'
AND (vPerformanceRule.CounterName IN ('% Processor Time'))
AND (vManagedEntity.Path IN (SELECT dbo.vManagedEntity.Name
FROM dbo.vManagedEntity INNER JOIN
dbo.vRelationship On dbo.vManagedEntity.ManagedEntityRowId = dbo.vRelationship.TargetManagedEntityRowId INNER JOIN
dbo.vManagedEntity As CompGroup On dbo.vRelationship.SourcemanagedEntityRowId = CompGroup.ManagedEntityRowId
WHERE CompGroup.DisplayName = 'bemis ibb prod'
ORDER BY path, vPerf.DateTime
Results
DateTime
SampleCount
AverageCPU
InstanceName
Path
ObjectName
CounterName
2/26/15 3:00 PM
2
1.98
_Total
servername.corp.com
Processor Information
% Processor Time
2/26/15 4:00 PM
2
2.09
_Total
servername.corp.com
Processor Information
% Processor Time
2/26/15 5:00 PM
2
1.72
_Total
servername.corp.com
Processor Information
% Processor Time
2/26/15 6:00 PM
2
1.83
_Total
servername.corp.com
Processor Information
% Processor Time
Thanks in Advance!
Mike HanlonHi
Sql Query
SELECT TOP 10
vPerf.DateTime,
vPerf.SampleCount,
cast(vPerf.AverageValue as numeric(10,2)) as AverageCPU,
vPerformanceRuleInstance.InstanceName,
vManagedEntity.Path,
vPerformanceRule.ObjectName,
vPerformanceRule.CounterName
FROM Perf.vPerfHourly AS vPerf INNER JOIN
vPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRowId = vPerf.PerformanceRuleInstanceRowId
INNER JOIN
vManagedEntity ON vPerf.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN
vPerformanceRule ON vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
WHERE
vPerf.DateTime >= DATEADD(Day, -1, GetDate())
AND vPerformanceRule.ObjectName like '%Processor Information%'
AND vPerformanceRuleInstance.InstanceName = '_Total'
AND (vPerformanceRule.CounterName IN ('% Processor Time'))
AND (vManagedEntity.Path IN (SELECT dbo.vManagedEntity.Name
FROM dbo.vManagedEntity INNER JOIN
dbo.vRelationship On dbo.vManagedEntity.ManagedEntityRowId = dbo.vRelationship.TargetManagedEntityRowId INNER
JOIN
dbo.vManagedEntity As CompGroup On dbo.vRelationship.SourcemanagedEntityRowId = CompGroup.ManagedEntityRowId
WHERE CompGroup.DisplayName = 'bemis ibb prod'
ORDER BY path, vPerf.DateTime
Regards
sridhar v -
ORA-06502 on 'SQL query' report with sort in 'Report Attributes'
Hi All,
We get the next error if we set sorting on a column in a 'Report' based on a 'SQL query'. Removing the sort, error disappeares:
failed to parse SQL query:
ORA-06502: PL/SQL: numeric or value error: NULL index table key value
Any suggestions?
ErikErik,
Thanks, this explains it. By specifying the request as part of your URL you run into the recently uncovered issue. The request you're setting is REMFROMLIST and ADD2LIST. You probably either have links that include those requests or you have branches where you specify them. Either way, in order to get reports sorting to work, you'll have to make sure that the request strings are not part of your URL. This is a work-around and the upcoming HTML DB patch release will solve this issue.
One way of avoiding this is to have computations on the previous pages that set a napplication level or page level item to the REMFROMLIST and ADD2LIST values and then you can use those items for your conditions that are currently evaluating those strings.
Hope this helps and sorry for the inconvenience,
Marc -
SQL Query report - how to evaluate the current sort column?
Hi,
I have a need to determine which column has been selected to sort the current report by. I need to pull this column name and pass it when a button is pressed so that the ensuing PDF report generated using PLPDF will be able to sort the data the same way.
thanks in advance.Hi,
As i think, you need to create report manually using SQL query and for sorting you can put a drop down box and user can select a field name and shorting type that is ASC or DESC from another drop down and than generate a report, additionally you can have another button for exporting to PDF that you can now manage through PLPDF and you can get the shorting column.
hope this can help you.
Thanks,
Jaydip -
Hello,
Can someone write an sql query using fieldname and table to sort.
I am using the Database Connectivity Toolset and I believe I am able to query using sql but I am not sure about the syntax for sorting.
I looked it up, but I am coming up with an error when implementating it in my vi.
Thanks.Thanks for helping. I appreciate your input and time.
I have attached what I have seen and it does not show the sql query although I have done as you suggested.
I have also pasted a little of the table: jenny and the fields that I am sorting in ascending and descending order by sql.
Message Edited by roboticstudent on 03-09-2006 10:05 AM
Attachments:
Jenny.doc 279 KB -
SQL Query Result with Random Sorting
Hi Experts,
My Oracle Version : Oracle9i
I have three tables which are given below,
Table Name: check_team
team_id team_code
100 A
101 B
102 C
103 D
Table Name: check_product
product_id product_code
1 XXX
2 XYZ
Table Name: check_team_products
tprod_id tprod_team_id tprod_product_id
1 100 1
2 100 2
3 101 1
4 101 2
5 102 1
6 102 2
7 103 1
8 103 2
Required Output First Time:
team_id team_code product_id product_code
100 A 1 XXX
101 B 2 XYZ
102 A 1 XXX
103 B 2 XYZ
Required Output Second Time:
team_id team_code product_id product_code
100 B 2 XYZ
101 A 1 XXX
102 B 2 XYZ
103 A 1 XXXI need the result as Required Output specified above and also the result has to be random too.. Can someone help me in writing a SQL Query to get results as that?
Added Oracle VersionSo, is it something like this you want?
SQL> ed
Wrote file afiedt.buf
1 with check_team as (select 100 as team_id, 'A' as team_code from dual union all
2 select 101, 'B' from dual union all
3 select 102, 'C' from dual union all
4 select 103, 'D' from dual)
5 ,check_product as (select 1 as product_id, 'XXX' as product_code from dual union all
6 select 2, 'XYZ' from dual)
7 ,check_team_products as (select 1 as tprod_id, 100 as tprod_team_id, 1 as tprod_product_id from dual union all
8 select 2, 100, 2 from dual union all
9 select 3, 101, 1 from dual union all
10 select 4, 101, 2 from dual union all
11 select 5, 102, 1 from dual union all
12 select 6, 102, 2 from dual union all
13 select 7, 103, 1 from dual union all
14 select 8, 103, 2 from dual)
15 --
16 -- end of test data
17 --
18 select team_id, team_code, product_id, product_code
19 from (
20 select t.team_id, t.team_code, p.product_id, p.product_code
21 ,row_number() over (partition by team_id order by dbms_random.random()) as rn
22 from check_team t join check_team_products tp on (tp.tprod_team_id = t.team_id)
23 join check_product p on (p.product_id = tp.tprod_product_id)
24 )
25* where rn = 1
SQL> /
TEAM_ID T PRODUCT_ID PRO
100 A 2 XYZ
101 B 1 XXX
102 C 2 XYZ
103 D 1 XXX
SQL> /
TEAM_ID T PRODUCT_ID PRO
100 A 2 XYZ
101 B 1 XXX
102 C 2 XYZ
103 D 1 XXX
SQL> /
TEAM_ID T PRODUCT_ID PRO
100 A 1 XXX
101 B 2 XYZ
102 C 1 XXX
103 D 1 XXX -
SQL query problem with sorting
Hi,
I have question regarding sql query . Right now I am getting the results like this if i use this sql query
select ID,Name,Desc,Priority from emp order by Priority ;
Priority is varchar field. I don't want to change the Priority field and cannot add a new column in the table. Because i don't have permission to do that.
ID Name Desc Priority
=============================================
234 paul paul desc Highest
3452 mike mike desc High
4342 smith smith desc Low
6565 kelly kelly desc Low
9878 nate nate desc Medium
3223 deb deb desc High
============================================
I need a query to get the results like that.
ID Name Desc Priority
=============================================
234 paul paul desc Highest
3452 mike mike desc High
3223 deb deb desc High
9878 nate nate desc Medium
4342 smith smith desc Low
6565 kelly kelly desc Low
============================================
If any one knows about this one, please let me know.
Thanks,
BalaYou are aware that there are differences in the SQL implementation between Sqlserver and Oracle? You could try something like this, if there's a INSTR function:
ORDER BY INSTR('Highest,High,Medium,Low,', Priority || ',')You may have to change the "Priority || ," to a "Priority + ','), if string concatenation is done differently in sqlserver. Don't know about the ('), maybe you need (").
C. -
How-To populate SELECT LIST default value from SQL Query
OK, I've done my homework, and did not find my answer in the Forum, so here it is.
I have a Page that displays fields from a SQL Query. The Page also has below that radiogroups, checkboxes, and Select Lists to allow the user to change values in the fields that are displayed at the top of the Region. I am able to pre-populate the radiogroups and checkboxes by performing a SELECT in the 'Source value or expression' of the Source area of the Page Item.
However, I am unable to do the same for the Select List fields. Their default value ends up being the first value in the LOV ('-- None --' for NULL values). Source Used: Only when current value in session state is null. Source Type: SQL Query. Also, when I first go into the Page when running it, and check the Session State values, they are all null, so I don't understand why the field is not populated by the SQL Query statement as the radiogroups and checkboxes are.
Any suggestions??? I've tried all sorts of combinations.Thank you for the suggestion.
I had considered that, but cannot do so, because we are using Oracle Application Express more for development than for data containment.
We have all our data in an Oracle 10.g DB which is separate from the OAEX server, and the OAEX app will reference that data via VIEWs and DB LINKs. We are doing so primarily as an added data security layer, where the data is housed separate from the app, in case the Web site is ever compromised. The data that can be viewed is restricted to a subset of the actual data that is available.
Since the data is on a separate server, (I assume) we will not be able to set the source type to Database column, because (I asume) that is dependent upon the data being housed by the OAEX server.
That still leaves me with having to populate the field with a SELECT statement from the Oracle DB. This unfortuneately is almost a show-stopper for me because of down-stream processing data requirements. Have not been able to come up with contingencies yet. -
How to compare same SQL query performance in different DB servers.
We have Production and Validation Environment of Oracle11g DB on two Solaris OSs.
H/W and DB,etc configurations of two Oracle DBs are almost same in PROD and VAL.
But we detected large SQL query performace difference in PROD DB and VAL DB in same SQL query.
I would like to find and solve the cause of this situation.
How could I do that ?
I plan to compare SQL execution plan in PROD and VAL DB and index fragmentations.
Before that I thought I need to keep same condition of DB statistics information in PROD and VAL DB.
So, I plan to execute alter system FLUSH BUFFER_CACHE;
But I am worring about bad effects of alter system FLUSH BUFFER_CACHE; to end users
If we did alter system FLUSH BUFFER_CACHE; and got execution plan of that SQL query in the time end users do not use that system ,
there is not large bad effect to end users after those operations?
Could you please let me know the recomendation to compare SQL query performace ?Thank you.
I got AWR report for only VAL DB server but it looks strange.
Is there any thing wrong in DB or how to get AWR report ?
Host Name
Platform
CPUs
Cores
Sockets
Memory (GB)
xxxx
Solaris[tm] OE (64-bit)
.00
Snap Id
Snap Time
Sessions
Cursors/Session
Begin Snap:
xxxx
13-Apr-15 04:00:04
End Snap:
xxxx
14-Apr-15 04:00:22
Elapsed:
1,440.30 (mins)
DB Time:
0.00 (mins)
Report Summary
Cache Sizes
Begin
End
Buffer Cache:
M
M
Std Block Size:
K
Shared Pool Size:
0M
0M
Log Buffer:
K
Load Profile
Per Second
Per Transaction
Per Exec
Per Call
DB Time(s):
0.0
0.0
0.00
0.00
DB CPU(s):
0.0
0.0
0.00
0.00
Redo size:
Logical reads:
0.0
1.0
Block changes:
0.0
1.0
Physical reads:
0.0
1.0
Physical writes:
0.0
1.0
User calls:
0.0
1.0
Parses:
0.0
1.0
Hard parses:
W/A MB processed:
16.7
1,442,472.0
Logons:
Executes:
0.0
1.0
Rollbacks:
Transactions:
0.0
Instance Efficiency Percentages (Target 100%)
Buffer Nowait %:
Redo NoWait %:
Buffer Hit %:
In-memory Sort %:
Library Hit %:
96.69
Soft Parse %:
Execute to Parse %:
0.00
Latch Hit %:
Parse CPU to Parse Elapsd %:
% Non-Parse CPU:
Shared Pool Statistics
Begin
End
Memory Usage %:
% SQL with executions>1:
34.82
48.31
% Memory for SQL w/exec>1:
63.66
73.05
Top 5 Timed Foreground Events
Event
Waits
Time(s)
Avg wait (ms)
% DB time
Wait Class
DB CPU
0
100.00
Host CPU (CPUs: Cores: Sockets: )
Load Average Begin
Load Average End
%User
%System
%WIO
%Idle
Instance CPU
%Total CPU
%Busy CPU
%DB time waiting for CPU (Resource Manager)
Memory Statistics
Begin
End
Host Mem (MB):
SGA use (MB):
46,336.0
46,336.0
PGA use (MB):
713.6
662.6
% Host Mem used for SGA+PGA:
Time Model Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics - Detail
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Foreground Wait Class
s - second, ms - millisecond - 1000th of a second
ordered by wait time desc, waits desc
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Captured Time accounts for % of Total DB time .00 (s)
Total FG Wait Time: (s) DB CPU time: .00 (s)
Wait Class
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
%DB time
DB CPU
0
100.00
Back to Wait Events Statistics
Back to Top
Foreground Wait Events
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Background Wait Events
ordered by wait time desc, waits desc (idle events last)
Only events with Total Wait Time (s) >= .001 are shown
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Event
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
Waits /txn
% bg time
log file parallel write
527,034
0
2,209
4
527,034.00
db file parallel write
381,966
0
249
1
381,966.00
os thread startup
2,650
0
151
57
2,650.00
latch: messages
125,526
0
89
1
125,526.00
control file sequential read
148,662
0
54
0
148,662.00
control file parallel write
41,935
0
28
1
41,935.00
Log archive I/O
5,070
0
14
3
5,070.00
Disk file operations I/O
8,091
0
10
1
8,091.00
log file sequential read
3,024
0
6
2
3,024.00
db file sequential read
1,299
0
2
2
1,299.00
latch: shared pool
722
0
1
1
722.00
enq: CF - contention
4
0
1
208
4.00
reliable message
1,316
0
1
1
1,316.00
log file sync
71
0
1
9
71.00
enq: CR - block range reuse ckpt
36
0
0
13
36.00
enq: JS - queue lock
459
0
0
1
459.00
log file single write
414
0
0
1
414.00
enq: PR - contention
5
0
0
57
5.00
asynch descriptor resize
67,076
100
0
0
67,076.00
LGWR wait for redo copy
5,184
0
0
0
5,184.00
rdbms ipc reply
1,234
0
0
0
1,234.00
ADR block file read
384
0
0
0
384.00
SQL*Net message to client
189,490
0
0
0
189,490.00
latch free
559
0
0
0
559.00
db file scattered read
17
0
0
6
17.00
resmgr:internal state change
1
100
0
100
1.00
direct path read
301
0
0
0
301.00
enq: RO - fast object reuse
35
0
0
2
35.00
direct path write
122
0
0
1
122.00
latch: cache buffers chains
260
0
0
0
260.00
db file parallel read
1
0
0
41
1.00
ADR file lock
144
0
0
0
144.00
latch: redo writing
55
0
0
1
55.00
ADR block file write
120
0
0
0
120.00
wait list latch free
2
0
0
10
2.00
latch: cache buffers lru chain
44
0
0
0
44.00
buffer busy waits
3
0
0
2
3.00
latch: call allocation
57
0
0
0
57.00
SQL*Net more data to client
55
0
0
0
55.00
ARCH wait for archivelog lock
78
0
0
0
78.00
rdbms ipc message
3,157,653
40
4,058,370
1285
3,157,653.00
Streams AQ: qmn slave idle wait
11,826
0
172,828
14614
11,826.00
DIAG idle wait
170,978
100
172,681
1010
170,978.00
dispatcher timer
1,440
100
86,417
60012
1,440.00
Streams AQ: qmn coordinator idle wait
6,479
48
86,413
13337
6,479.00
shared server idle wait
2,879
100
86,401
30011
2,879.00
Space Manager: slave idle wait
17,258
100
86,324
5002
17,258.00
pmon timer
46,489
62
86,252
1855
46,489.00
smon timer
361
66
86,145
238628
361.00
VKRM Idle
1
0
14,401
14400820
1.00
SQL*Net message from client
253,909
0
419
2
253,909.00
class slave wait
379
0
0
0
379.00
Back to Wait Events Statistics
Back to Top
Wait Event Histogram
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (64 msec to 2 sec)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 sec to 2 min)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 min to 1 hr)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Wait Class Stats
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
SQL Statistics
SQL ordered by Elapsed Time
SQL ordered by CPU Time
SQL ordered by User I/O Wait Time
SQL ordered by Gets
SQL ordered by Reads
SQL ordered by Physical Reads (UnOptimized)
SQL ordered by Executions
SQL ordered by Parse Calls
SQL ordered by Sharable Memory
SQL ordered by Version Count
Complete List of SQL Text
Back to Top
SQL ordered by Elapsed Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by CPU Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by User I/O Wait Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Gets
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Reads
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Physical Reads (UnOptimized)
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Executions
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Parse Calls
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Sharable Memory
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Version Count
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Complete List of SQL Text
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Instance Activity Statistics
Instance Activity Stats
Instance Activity Stats - Absolute Values
Instance Activity Stats - Thread Activity
Back to Top
Instance Activity Stats
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Absolute Values
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Thread Activity
Statistics identified by '(derived)' come from sources other than SYSSTAT
Statistic
Total
per Hour
log switches (derived)
69
2.87
Back to Instance Activity Statistics
Back to Top
IO Stats
IOStat by Function summary
IOStat by Filetype summary
IOStat by Function/Filetype summary
Tablespace IO Stats
File IO Stats
Back to Top
IOStat by Function summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
ordered by (Data Read + Write) desc
Function Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Waits: Count
Avg Tm(ms)
Others
28.8G
20.55
.340727
16.7G
2.65
.198442
1803K
0.01
Direct Reads
43.6G
57.09
.517021
411M
0.59
.004755
0
LGWR
19M
0.02
.000219
41.9G
21.87
.496493
2760
0.08
Direct Writes
16M
0.00
.000185
8.9G
1.77
.105927
0
DBWR
0M
0.00
0M
6.7G
4.42
.079670
0
Buffer Cache Reads
3.1G
3.67
.037318
0M
0.00
0M
260.1K
3.96
TOTAL:
75.6G
81.33
.895473
74.7G
31.31
.885290
2065.8K
0.51
Back to IO Stats
Back to Top
IOStat by Filetype summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
Small Read and Large Read are average service times, in milliseconds
Ordered by (Data Read + Write) desc
Filetype Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Small Read
Large Read
Data File
53.2G
78.33
.630701
8.9G
7.04
.105197
0.37
21.51
Log File
13.9G
0.18
.164213
41.9G
21.85
.496123
0.02
2.93
Archive Log
0M
0.00
0M
13.9G
0.16
.164213
Temp File
5.6G
0.67
.066213
8.1G
0.80
.096496
5.33
3713.27
Control File
2.9G
2.16
.034333
2G
1.46
.023247
0.05
19.98 -
Hi I joined two table and created the new table called FMW_ANALY. Which has some repeating rows. I used the following Query to list the top 10 customers by value
SELECT *
FROM
(SELECT CUSTOMER, OPP_VALUE, RANK() OVER (order by OPP_VALUE DESC) opp_val_rank
FROM FMW_ANALY)
WHERE opp_val_rank<=10;
I'm getting the following result
Customer Opp Value Opp Val Rank
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Department of Education and Training 8991776.99 1
Investments Commission 7447419.84 22
Bank Limited 4803000 23
Bank Limited 4803000 23
Bank Limited 4803000 23
Bank Limited 4803000 23
Bank Limited 4803000 23
Bank Limited 4803000 23
Bank Limited 4803000 23
Bank Limited 4803000 23
How can I Query without these repeating rows?
Thank you
VickExample which will help you understand Rank, Dense Rank
SQL> ed
Wrote file afiedt.buf
1 select deptno, ename,sal,
2 rank()
3 over (order by sal desc)rnk,
4 dense_rank()
5 over (order by sal desc)densernk
6 from emp2
7* order by sal desc
SQL> /
DEPTNO ENAME SAL RNK DENSERNK
10 KING2 5000 1 1
10 KING 5000 1 1
20 SCOTT2 3630 3 2
20 SCOTT 3630 3 2
20 JONES2 3272 5 3
20 JONES 3272 5 3
20 FORD2 3000 7 4
20 FORD 3000 7 4
30 BLAKE2 2850 9 5
30 BLAKE 2850 9 5
10 CLARK2 2450 11 6
10 CLARK 2450 11 6
30 ALLEN2 1600 13 7
30 ALLEN 1600 13 7
30 TURNER2 1500 15 8
30 TURNER 1500 15 8
10 MILLER2 1300 17 9
10 MILLER 1300 17 9
30 WARD2 1250 19 10
30 WARD 1250 19 10
30 MARTIN2 1250 19 10
30 MARTIN 1250 19 10
20 ADAMS2 1100 23 11
20 ADAMS 1100 23 11
30 JAMES2 950 25 12
30 JAMES 950 25 12
20 SMITH2 800 27 13
20 SMITH 800 27 13
28 rows selected.
SQL> ed
Wrote file afiedt.buf
1 SELECT * FROM
2 (
3 select deptno, ename,sal,
4 rank()
5 over (order by sal desc)rnk,
6 dense_rank()
7 over (order by sal desc)densernk
8 from emp2
9 order by sal desc
10 )
11* WHERE DENSERNK <=5
SQL> /
DEPTNO ENAME SAL RNK DENSERNK
10 KING2 5000 1 1
10 KING 5000 1 1
20 SCOTT2 3630 3 2
20 SCOTT 3630 3 2
20 JONES2 3272 5 3
20 JONES 3272 5 3
20 FORD2 3000 7 4
20 FORD 3000 7 4
30 BLAKE2 2850 9 5
30 BLAKE 2850 9 5
10 rows selected. -
SQL Query To Select The 5th Element
In the report I am currently working on, I am using an Add Command custom SQL query to pull the data that I need. The structure is a Call and a list of associated Activities. In this particular scenario, there are 8 activity notes for a type of call and I want to return the 5th one. The activity notes are a specific sequence of captured actions and I need the note from the 5th step in the sequence.
This is what I have come up with:
SELECT CALL.call_id,
(select top 1 from (select top 5 CONVERT(char(8000),ACTIVITY.activity_note) from ACTIVITY
where CALL.call_id = ACTIVITY.call_id
order by ACTIVITY.creat_date desc))
as activity_tx
FROM CALL
The intent of the Top 5 was to get the first 5 activity notes, of which the 5th note would be the last, then reverse sort them so I could take the Top 1 (which would be the 5th of 8). But I am getting a vague syntax error between "from" and "order by". Any suggestions would be appreciated.
Thanks!
Fuskie
Who thought he had a solution but is flummoxed he can't bring it home...Hello,
Let me explain that Crystal assumes the user knows how to write SQL. We only report on the data provided by the SQL you write.
I did a quick search using Microsofts new search engine - www.bing.com and it returned this as well as lots more:
http://forums.devshed.com/php-development-5/how-to-access-a-certain-element-in-the-results-of-606217.html
Try searching in MSSQL's site also for more info on how to get the results you are looking for.
Thank you
Don
Maybe you are looking for
-
Error when opening the database with resetlogs
ORA-00603: ORACLE SERVER SESSION TERMINATED BY FATAL ERROR WHEN I open the database with RESETLOGS
-
Hi all, First off, I am forced to use JDK 1.18. I am having problem in displaying arabic, both through AWT as well as at the console. My desktop (Windows XP) supports arabic. The following does not do much. It was just supposed to show how it works.
-
Embed Animated Flash Objects (*.swf file) in Oracle Forms.
Hello All, To Embed Animated Flash Object (Shockwave *.swf File) in Oracle Forms, Please Follow the Steps Below. 1. Draw "ActiveX Control" Item on Canvas with the Name "OCXITM". 2. Select "ActiveX Control" Item & Go to its Properties (By Pressing F4)
-
Reading metadata to - from image files
I am using Creative Suite CS4. In CS3 I created two custom XMP metadata pages that I used to add information to RAW, TIF, PSD files. The resulting custom panel could be seen and used in Bridge and Extensis Portfolio. In CS4 that all changed. I ca
-
i try to purchase a movie but when it started to download the movie about 10 minutes into it it stopped and gave me this message "an unknown error occurred (-50) ...what should i do help me out please