Sql group function
I am trying to calculate the average cost of the books for each customer. The output should contain the customer#, name and the average order.
This is the code I have:
SELECT AVG(SUM((retail-cost)*quantity))
FROM orders JOIN orderitems USING (order#)
JOIN books USING (isbn)
JOIN customers USING (customer#)
GROUP BY order#, customer#;
I get either, over 8000 for the average order or about 33 for the average order when I don't include the name, customer number or anything else in the code. If I add any other information, I get:
SELECT customer#, AVG(SUM((retail-cost)*quantity))
ERROR at line 1:
ORA-00937: not a single-group group function
I'm sure there is something small that I am missing, but cannot see it.
Hi,
Whenever you have a question, you should post a little sample data and the results you want to get from that data.
I don't know where you're coming from, or where you want ot go, so it's hard to give you good directions. All I have is your current route plan, which must be incorrect, or else you wouldn't be asking anything.
I see you are nesting aggregate functions. That's very rare in real life, and the result is always to produce one row of output, regardless of what's in the GROUP BY clause.
I suspect you want to do a SUM in a sub-query, and then do AVG on the results in the main query. Without seeing your sample data and desired results, I'm just guessing.
Similar Messages
-
PL/SQL equivalent of T-SQL - "group function is not allowed here"
Hi all, hope someone can give me a hand as I'm pretty stuck! I have been trying to convert some MS SQL Server T-SQL statements into Oracle PL/SQL and am stuck on the below one:
SELECT
CA.AssessmentID,
(SELECT ProductName + ISNULL(' - ' + PrincipalBenefit,'')
FROM rptPolicySnapshot WHERE PolicyID = MAX(CA.PolicyID)
AND SnapshotID = 1),
MAX(CA.PolicyID)
FROM rptClaimInvoiceLineSnapshot CIL
INNER JOIN rptClaimAssessmentSnapshot CA
ON CIL.AssessmentID = CA.AssessmentID
AND CIL.SnapshotID = CA.SnapshotID
WHERE CIL.SnapshotID = 1
GROUP BY CA.AssessmentID
This works fine in MSSQL but returns the below error in Oracle:
'ORA-00934: group function is not allowed here'
If I take out the subquery the query works fine.
Any ideas as to the syntax? I am new to Oracle so not sure as to how I should go about writing this.
Thanks in advance!
LeoWITH x AS (SELECT ca.assessmentid,
MAX (ca.policyid) policy_id
FROM rptclaiminvoicelinesnapshot cil
INNER JOIN rptclaimassessmentsnapshot ca
ON cil.assessmentid = ca.assessmentid
AND cil.snapshotid = ca.snapshotid
WHERE cil.snapshotid = 1
GROUP BY ca.assessmentid
SELECT x.assessment_id,
x.policy_id,
productname + decode(principalbenefit,null,null,' - ' || principalbenefit ) prodname
FROM rptpolicysnapshot, x
WHERE policyid = x.policy_id
AND snapshotid = 1I think that's in the neighbourhood. -
Use of sql group function in orcl:query-database - urgent
All,
Version: 10.1.3.4
Two requirements for me:
1. I want to use sum function in orcl:query-database. How to use it?
For ex: I tried the following
<xsl:value-of select='orcl:query-database("select sum(salary) from emp",false(),false(),"jdbc/DB1")'/>
I got the following error
oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an XML tag name.
When I tried without sum function, it works fine
2. I used the same table, but without the sum function as below
<xsl:value-of select='orcl:query-database("select salary from emp",false(),false(),"jdbc/DB1")'/>
This time, it returns the first employees salary!! I dont understand this logic. I expected either the query returns all the rows else it throws error, but none of them were true!
Can anyone pls explain what is the behavior? I want your reply for both the queries!
Currently I'm in a project where I'm working in the similar scenario, so please guru's let me know ASAP.
Thanks,
SenHi Sen,
Create a normal variable variable in XSLT.
Then use that variable.
I mean variable name='Var_1' select='Your Query'
Now use Var_1/yourcollection/...
I am giving some example
<xsl:variable name="Stopdetails" select="/ns0:MyEBM/ns0:DataArea/ns0:MyEBO/ns0:Stops/ns0:Stop[ns0:StopID=$TempStopId]"/>
<xsl:variable name="AccStopTypeVar">
<xsl:value-of select="$Stopdetails/ns0:StopType"/>
</xsl:variable>If you want you can loop on the created variable.
You can do these in XSL.
But DB calls those things ...it would be better , if u take them out. Spme debugging problems are there with XSL.
Regards
PavanKumar.M -
PL/SQL: ORA-00934: group function is not allowed here
Hi,
I am writing a PL/SQL procedure. The structure is like :
SET SERVEROUTPUT ON;
CREATE OR REPLACE Procedure abc
IS
v_total_ip_rec number(14);
v_total_op_rec number(14);
v_total_rec number(14);
BEGIN
SELECT SUM (CASE
WHEN <condition 1>
THEN 1
ELSE 0
END
) into v_total_ip_rec,
SUM (CASE
WHEN <condition 2>
THEN 1
ELSE 0
END
) into v_total_op_rec,
SUM (1) into v_total_rec
FROM A,B
WHERE A.Col1=B.Col1;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;
When I run this procedure it gives me following error:
"PL/SQL: ORA-00934: group function is not allowed here"
Anybody have any idea?
Any help would be appreciated.
Thanks.Hi Arunkumar ,
I think you don't need subquery.
Regards Salim.
Or.
SELECT COUNT (CASE
WHEN <condition 1>
THEN 1
END) v_total_ip_rec,
COUNT (CASE
WHEN <condition 2>
THEN 1
END) v_total_op_rec,
COUNT (1) v_total_rec
FROM a, b
WHERE a.col1 = b.col1 -
Grouping Function usage in SQL
All,
How does grouping function work, does it also depends on the sequence of columns used in group by rollup
select deptno,job, group_id(), sum(sal), grouping(deptno) , grouping(job)
from emp
group by rollup (deptno, job)
If the query is run by "rollup(job,deptno)" grouping (deptno) returns 1 where as if "rollup(deptno,job)" grouping (deptno) returns 0.
Does the column sequence in group by rollup decides the returning of grouping(deptno) function. I feel to have some misunderstanding of the way its said in ORACLE documentation. We referred to the below link for our understanding.
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions071.htm
Request the PRO's to discuss and clarify on this.Hi,
ramarun wrote:
All,
How does grouping function work, GROUPING (x) returns 1 if the current row represents a superaggregate of x, and 0 otherwise. In other words, if GROUPING (x) is 0, then the row represents a single value of x. If GROUPING (x) is 1, then the row represents a total of all values of x.
For example the query you posted may produce results like this:
` DEPTNO JOB GROUP_ID() SUM(SAL) GROUPING(DEPTNO) GROUPING(JOB)
20 ANALYST 0 6000 0 0
ANALYST 0 6000 1 0
10 CLERK 0 1300 0 0
20 CLERK 0 1900 0 0
30 CLERK 0 950 0 0
CLERK 0 4150 1 0
10 MANAGER 0 2450 0 0
20 MANAGER 0 2975 0 0
30 MANAGER 0 2850 0 0
MANAGER 0 8275 1 0
10 PRESIDENT 0 5000 0 0
PRESIDENT 0 5000 1 0
30 SALESMAN 0 5600 0 0
SALESMAN 0 5600 1 0
0 29025 1 1Look at the last three rows. On this row
` DEPTNO JOB GROUP_ID() SUM(SAL) GROUPING(DEPTNO) GROUPING(JOB)
30 SALESMAN 0 5600 0 0GROUPING (deptno) is 0; so the row represents only deptno=30.
GROUPINT (job) is 0, so the row represents only job='SALESMAN'.
SUM (sal) is 5600, so the total salary of all salesmen in department 30 is 5600.
Now look at this row:
` DEPTNO JOB GROUP_ID() SUM(SAL) GROUPING(DEPTNO) GROUPING(JOB)
SALESMAN 0 5600 1 0GROUPING (deptno) is 1; so the row does not represent any one deptno; it is a superaggregate of all deptnos. Notice that the deptno column is NULL, even though there are no rows in the table where deptno is NULL.
GROUPING (job) is 0, so the row represents only job='SALESMAN'.
SUM (sal) is 5600, so the total salary of all salesmen in any department is 5600. (As it happens, all the salesmen are in department 30, so this sum is the same as on the previous row.)
Now look at the last row:
` DEPTNO JOB GROUP_ID() SUM(SAL) GROUPING(DEPTNO) GROUPING(JOB)
0 29025 1 1GROUPING (deptno) is 1; so the row does not represent any one deptno; it is a superaggregate of all deptnos. Notic that both deptno and job are both NULL on this row of output, even though neither column is ever NULL in the table.
GROUPING (job) is 0, so the row represents only job='SALESMAN'.
SUM (sal) is 5600, so the total salary of people with any job and any department is 29025.
does it also depends on the sequence of columns used in group by rollup Excellent question! Try it an see. Change the order or columns in the GROUP BY clause and see. If you get different results, then the order does matter.
select deptno,job, group_id(), sum(sal), grouping(deptno) , grouping(job)
from emp
group by rollup (deptno, job) If the query is run by "rollup(job,deptno)" grouping (deptno) returns 1 where as if "rollup(deptno,job)" grouping (deptno) returns 0. You get different results; therefore the order does matter.
Does the column sequence in group by rollup decides the returning of grouping(deptno) function...Yes.
"GROUP BY ROLLUP (deptno, job)" means a superaggregate row for each value of job, representing all deptnos, will be formed. That is, you will get one row representing all analysts; another row representing all clerks, another row representing all managers, and so on. This will be similar to the results that you would get if you never mentioned the first expression in the ROLLUP list, that is, deptno. You will not get a superaggregate row representing any one deptno, say, 10.
"GROUP BY ROLLUP (job, deptno)" means a superaggregate row for each value of deptno, representing all jobs, will be formed. That is, you will get one row representing all anlysts; another row representing deprtment 10, another row representing department 20, and so on. This will be similar to the results that you would get if you never mentioned the first expression in the ROLLUP list, that is, job. You will not get a superaggregate row representing any one job, say, 'ANALYST'. -
ORA-00935: group function is nested too deeply - SQL Query is correct...
select s.sname, to_char(sum(t.amount), 'fm$999999.00')
from transactions t, salespeople s
where t.sid = s.sid
group by s.sname, t.year
having (t.year = 1997) and max(sum(t.amount));
I'm trying to print sales person name who had the highest total sell in 1997. I do not see where did i go wrong in the above query...Isn't nested group function allowed?!
What about this?
select s.sname, to_char(sum(t.amount), 'fm$999999.00') as "TOTAL"
from transactions t, salespeople s
where t.sid = s.sid
group by s.sname, t.year
having (t.year = 1997) and sum(t.amount) = (select max(amount) from transactions where year = 1997);
It should return something, but it does not due lack of data in database. I think the above code is correct. I just need to confirm from you...select s.sname, (case when sum(t.amount) > sum(t2.amount)
then sum(t.amount)
else sum(t2.amount)
end) "TOTAL"
from transactions t, salespeople s
where t.sid = s.sid
group by s.sname, t.year
having t.year = 1997
union
select s.sname, sum(t2.amount)
from transactions t2, salespeople s
where t2.sid = s.sid
group by s.sname, t2.year
having t2.year = 1997;
Your code looks good, but it does not work in Oracle Developer...
The above should work isn't it? The inner query gets executed then the outer one so the result i get in -
How to create a user_defined grouping function?
I need to create a user_defined function and use it in my sql statement.
I know the user_defined function can be used anywhere the build-in function can be used.In oracle,there are grouping functions.
How can I create a user_defined grouping function and I can use it in my sql statement.Hi, can you explain exactly what you are trying to achieve:
SQL> create or replace function my_func return number as
2 begin
3 return 5;
4 end;
5 /
Function created.
SQL> select deptno,my_func(),max(sal)
2 from emp
3 group by deptno,my_func()
4 /
DEPTNO MY_FUNC() MAX(SAL)
10 5 5000
20 5 3000
30 5 2850 -
Not a single-group group function very urgent
HI,
select sum(avg(wait_to))+sum(avg(idle))+sum(avg(users))+sum(avg(system)) from system_cpu
where hostid='DSCP02469' group by cpuid
this query is working
but i want cpuid group to be displayed
so i wrote query like this.
select cpuid,sum(avg(wait_to))+sum(avg(idle))+sum(avg(users))+sum(avg(system)) from system_cpu
where hOstid=' ' group by cpuid it is throwing a error
not a single-group group function.
how can get sum of avg of colums,column based on some coloum
group by column
id,sum(avg( )) i have to get
please give me solution.
send me mail to [email protected]hi,
thanku for immediate reply but
if i do that
select cpuid, a+b+c+d total_value from (select cpuid,
sum(avg(wait_to)) a, sum(avg(idle)) b,sum(avg(users)) c,sum(avg(system)) d
from system_cpu where hostid='DSCP02469' group by cpuid)
SQL> /
select cpuid, a+b+c+d total_value from (select cpuid,
ERROR at line 1:
ORA-00937: not a single-group group functionelse
select cpuid, a+b+c+d total_value from (select
sum(avg(wait_to)) a, sum(avg(idle)) b,sum(avg(users)) c,sum(avg(system)) d
from system_cpu where hostid='DSCP02469' group by cpuid)
SQL> /
select cpuid, a+b+c+d total_value from (select
ERROR at line 1:
ORA-00904: "CPUID": invalid identifier2)
can we use select in select case
can we use select sal, case when sal then select * from emp like this
with regards
shannu sarma -
Nested group function without group xmlagg
I am getting nested group function without group by xmlagg when using the xmlagg function inside another xmlagg function. Find the table structure and sample data here,
CREATE TABLE "TEST_TABLE"
("KEY" NUMBER(20,0),
"NAME" VARCHAR2(50 ),
"DESCRIPTION" VARCHAR2(100 )
Insert into TEST_TABLE (KEY,NAME,DESCRIPTION) values (1,'sam','desc1');
Insert into TEST_TABLE (KEY,NAME,DESCRIPTION) values (2,'max','desc2');
Insert into TEST_TABLE (KEY,NAME,DESCRIPTION) values (3,'peter',null);
Insert into TEST_TABLE (KEY,NAME,DESCRIPTION) values (4,'andrew',null);
select
XMLSerialize(document
xmlelement("root",
xmlagg(
xmlelement("emp"
, xmlforest(Key as "ID")
, xmlforest(name as "ename")
, xmlelement("Descriptions",
xmlagg(
xmlforest(description as "Desc")
) as clob indent
) as t
from test_table;Then i removed the xmlagg function from the above select query and used xmlelement instead
select
XMLSerialize(document
xmlelement("root",
xmlagg(
xmlelement("emp"
, xmlforest(Key as "ID")
, xmlforest(name as "ename")
, xmlelement("Descriptions",
xmlforest(description as "Desc")
) as clob indent
) as t
from test_table;This is working fine, but xml created with empty elements for Descriptions element for key 3 and 4 which has null values. I need don't need Descriptions element in the xml when it has null value. Please help me to resolve this.You can do it with a correlated subquery :
SQL> select xmlserialize(document
2 xmlelement("root",
3 xmlagg(
4 xmlelement("emp"
5 , xmlforest(
6 t.key as "ID"
7 , t.name as "ename"
8 , (
9 select xmlagg(
10 xmlelement("Desc", d.description)
11 order by d.description -- if necessary
12 )
13 from test_desc d
14 where d.key = t.key
15 ) as "Descriptions"
16 )
17 )
18 )
19 ) as clob indent
20 )
21 from test_table t;
XMLSERIALIZE(DOCUMENTXMLELEMEN
<root>
<emp>
<ID>1</ID>
<ename>sam</ename>
<Descriptions>
<Desc>desc1_1</Desc>
<Desc>desc1_2</Desc>
<Desc>desc1_3</Desc>
</Descriptions>
</emp>
<emp>
<ID>2</ID>
<ename>max</ename>
<Descriptions>
<Desc>desc2_1</Desc>
<Desc>desc2_2</Desc>
<Desc>desc2_3</Desc>
</Descriptions>
</emp>
<emp>
<ID>3</ID>
<ename>peter</ename>
</emp>
<emp>
<ID>4</ID>
<ename>andrew</ename>
</emp>
</root>
Or an OUTER JOIN + GROUP-BY :
select xmlserialize(document
xmlelement("root",
xmlagg(
xmlelement("emp"
, xmlforest(
t.key as "ID"
, t.name as "ename"
, xmlagg(
xmlforest(d.description as "Desc")
order by d.description -- if necessary
) as "Descriptions"
) as clob indent
from test_table t
left outer join test_desc d on d.key = t.key
group by t.key
, t.name
;Edited by: odie_63 on 11 juil. 2012 14:54 - added 2nd option -
Hello does anyone know how to use the group function in
coldfusion
my tables that out-puts to a html
is outputing multiple CEENO
for example CEENO
11111
11111
11111
11111
someone here said to use the group function in coldfusion
do you know where i can put it?
<table border="2" cellpadding="2" cellspacing="0">
<tr>
<th>Record Number</th>
<TH>PEA_id</TH>
<th width="120">CEENO</th>
<TH>Address</TH>
<TH>ZipCode</TH>
<th>AdvisoryDate</th>
</tr>
<cfloop query="getthecases">
<tr bgcolor="<cfif currentrow mod
2>GHOSTWHITE<cfelse>WHITE</cfif>">
<td>#CurrentRow#</td>
<td>#PEA_id</td>
<Td>#CEENO#</td>
<td>#ST_NO# #ST_initial# #st_dir#</td>
<td>#ZipCode#</td>
<td>#dateformat(ADVISORY_DATE,"mm/dd/yyyy")#</td>
</tr>
</cfloop>
</table>What they are referencing is the group attribute of the
CFOUTPUT tag:
<cfoutput query="qryName" group="groupName">
#dbgroupvar#
<cfoutput>
#otherdbdata#
</cfoutput>
</cfoutput>
However, you have to write the correct SQL to get this to
work and that includes using the ORDER BY clause in your SQL
Statement to specify what column on which to group the output.
For example, the following query would get all employees from
the database and order them by the department for which they work:
<cfquery name="qTest" datasource="dsn">
SELECT name, title, department
FROM employee
ORDER BY department
</cfquery>
We can use the group attribute of cfoutput to show all
employees for each department:
<cfoutput query="qTest" group="department">
<h1>#department#</h1>
<table>
<cfoutput>
<tr>
<td>#name#</td>
<td>#title#</td>
</tr>
</cfoutput>
</table>
Hope this helps.
Cheers,
Craig -
ORA-00934: group function is not allowed here
Hi,
My requirement is to check oi.quantity is equal to sum of packing_detail. quantity
by order_number
select oi.quantity_ordered oi_qu, pd.quantity pq
from ordered_items oi, packing_details pd
where oi.ordered_item_id = pd.ordered_item_id
and oi.quantity_ordered = sum(pd.quantity)
and oi.order_number = '29';
after executing above query I get error
SQL Error: ORA-00934: group function is not allowed here
00934. 00000 - "group function is not allowed here"
Please tell me how to resolve it.
Thanks in advance
SandyYou have to make use of a subquery;
select oi.quantity_ordered oi_qu, pd.quantity pq
from ordered_items oi, packing_details pd
where oi.ordered_item_id = pd.ordered_item_id
and oi.quantity_ordered = *(select sum(pd.quantity) from packing_details pd1 group by pd1.ordered_item_id)*
and oi.order_number = '29'; This is based on the assumption that ordered_items is the summarize data and packing_details are the line item level data.
regards,
Dipankar. -
Getting Group Function is not Allowed
Hello All....
When I run the following in the SQL command screen it works fine... But when I try to use it in APEX to populate page values, it gives me the error...
ERROR
1 error has occurred
ORA-06550: line 25, column 74: PL/SQL: ORA-00934: group function is not allowed here ORA-06550: line 24, column 1: PL/SQL: SQL Statement ignored
CODE THAT WORKS IN SQL COMMAND SCREEN
SELECT
SUM(CASE WHEN SLOT = 'Q' THEN '1' ELSE '0' END) AS C_SLOT,
SUM(CASE WHEN TEST = 'P' THEN '1' ELSE '0' END) AS C_TEST,
FROM TBL_REC;
CODE THAT GIVES ERROR ON APPLICATION EXPRESS PAGE
SELECT
SUM(CASE WHEN SLOT = 'Q' THEN '1' ELSE '0' END) INTO :P2_C_SLOT,
SUM(CASE WHEN TEST = 'P' THEN '1' ELSE '0' END) INTO :P2_C_TEST,
FROM TBL_REC;
The colums SLOT and TEST have letter codes, I just want it to count just when it matches a certain letter. In the SQL Command Screen, it is returning one row, with the counts, everything is fine. It is only a problem when I try to use it anywere on a page in Application Express.
The full version has about 20 lines that are all sum lines, but I can not even get the 2 line ver above to work.
Any thoughts?This will work .. the into clause goes after the select columns ... into var1 ,var2 etc ..
SELECT SUM(CASE
WHEN SLOT = 'Q' THEN
'1'
ELSE
'0'
END),
SUM(CASE
WHEN TEST = 'P' THEN
'1'
ELSE
'0'
END)
INTO :P2_C_SLOT, :P2_C_TEST,
FROM TBL_REC;SS -
Error in nested group function used with column name.
Hi Team,
If i used nested group function with column name its not working. Could you please any one suggest me.
How to use it.
Regards,
Venkat.
Please find Spool ........
SQL> select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name,CNT;
select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
ERROR at line 1:
ORA-00937: not a single-group group function
SQL> select max(max(CNT)) from(select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name;
MAX(MAX(CNT))
605Venkat wrote:
Hi Sayan
Its giving output like below, but not given maximum CNT.
SQL> select user_name,max(CNT)from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name;
USER_NAME MAX(CNT)
BANES_LERG 6
VENE_USER 8
USER3 339
DBUS 106
VEL_USER 37
SYS 597
6 rows selected.Check it - Re: Error in nested group function used with column name.
and previous post -
Hi, I need to list the shortest string along with the number of characters in the string, so far I've come up with:
SELECT eventtitle, MIN(LENGTH(eventtitle))
FROM event
Oracle XE is giving the error "not a single-group group function", but I can't quite see how to get "eventtitle" on it's own, the function "MIN(LENGTH(eventtitle))" does give me the desired result if run by its self. I'm grateful for any assistance!1 with t
2 as
3 (
4 select 'abcd' short_string from dual
5 union all
6 select 'a' short_string from dual
7 union all
8 select 'b' from dual
9 )
10 select short_string, rownum rn from t
11* order by length(short_string)
SQL> /
SHOR RN
a 2
b 3
abcd 1one version using analytics
1 with t
2 as
3 (
4 select 'abcd' short_string from dual
5 union all
6 select 'a' short_string from dual
7 union all
8 select 'b' from dual
9 )
10 select short_string, len from
11 (
12 select short_string, length(short_string) len, min(length(short_string)) over() min_length from t
13* ) where len = min_length
SQL>
SHOR LEN
a 1
b 1Regards
Raj -
I met ORA-00935 group function is nested too deeply Message.
Hi all,
I made a table like below,
==============================
CREATE TABLE ser_1m_det (
time TIMESTAMP,
proto NUMBER(3,0),
port NUMBER(5,0),
pkts NUMBER(17,0),
vol_m NUMBER(17,4)
====================================
Then I want to use below SQL
====================================
SELECT proto, port, SUM(pkts) pkts, SUM(vol_m) vol_m
FROM ser_1m_det
GROUP BY (proto, port)
HAVING time < SYSTIMESTAMP AND ROWNUM<10
ORDER BY SUM(pkts);
====================================
When I execute upper sql, I met this error message;
===================================
ORDER BY SUM(pkts)
ORA-00935 group function is nested too deeply
===================================
Then I search what this message mean.
====================================
ORA-00935 group function is nested too deeply
Cause: This is an internal error message not usually issued.
Action: Contact Oracle Support Services.
====================================
I install Oracle9iAS Infrastructure 9.0.2.0.0 on WIN2000.
(I am using DBMS in Oracle9iAS @.@)
-> DBMS version is Oracle9i Enterprise Edition Release 9.0.1.3.1
Anybody know why I met upper error message?
Thanks in advance.well,
first you want to group,
then you want to order,
and most probably then you are interested in the N top records.
I had a try on table USER_OBJECTS to make things easier:
select * from
(select
object_type
,status
,nvl(oi ,0) oi
,nvl(doi,0) doi
from
( select
object_type
,status
,sum(object_id) oi
,sum(data_object_id) doi
from
user_objects
where
created between sysdate -1000 and sysdate
group by
object_type
,status
) A
order by
oi desc
) B
where rownum < 5
;
Maybe you are looking for
-
Need to convert varchar2 into decimal
Hi, I need to convert source sybase varchar2 record in to decimal record in Target DB2 table by using the function in Oracle data integrator. In my source table, column is defined as varchar2 (4) and in target table same column has defined as Decimal
-
How i can change background in my tablet A3000
Dear Lenovp Support and User please i need help i need to change background in my tablet A3000 with a picture i need to change app bage background but i failed how i can change it
-
Can I make Genius ignore certain songs in my l
Is there a way to make Genius ignore certain songs when creating playlists? For example, if I create a playlist based on "Adult Alternative" music, Genius will frequently select some of my off-beat Christmas music.
-
EMET 4.0 on Windows 7 in Virtual Machine
I installed EMET 4.0 on a Windows 7 VM (fully updated) and it has now for 30+ minutes been using 100% of the CPU. I have 4 GB RAM allocated out of the 12 GB installed on the host machine. Makes using Windows 7 untenable with all the CPU being ate up
-
Hi Guys Odd one for you here... Whenever i insert a text area into the table here beside "comments" it crashes DW CS3 totally. I have rebuilt the page several times and it's the same thing.... I've googled it and got nothing. It's really odd. The oth