Group by in Oracle 8i
Did anyone know why oracle 8i did not return the rows in order coloumns used in the group by condition ?
Eg.
select emp_name,count(*)
from employees
where department = '971'
group by emp_name
The above query returned the count in name order in 7.3 by not in oracle 8i
Any help.
Thanks
A K
The problem is we converted the application from developer 2000 to forms 6i. It worked fine in 7.3. We are not sure in how many places we used this group by.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
Originally posted by harry dhillon:
Try using an 'order by ' clause if you want to have returned in a certain order.<HR></BLOCKQUOTE>
null
Similar Messages
-
How to subscribe to a group space in Oracle Web Center application
Hi All,
I am a newbie to Oracle Web Center and playing in and around with the Oracle WebCenter Spaces..
At the time of creation of Group Space in Oracle WebCenter Application, there are two options :
1. Adding the members by the owner of the group space
2. Opening the open group space which allows others users can join by searching the specified GroupSpace and joining into that group space.
If i try to do like this, I was getting this error :
WCS#2010.07.21.15.05.39: Unable to send subscription notification to moderator(s). The reason is : Can not retrieve group space workflow configuration. Please contact administrator.
Can anyone please help me to solve this out..
Thanks in advance
Regards,
Sandeep
Edited by: user10681665 on 22-Jul-2010 02:13Sandeep,
To get this notifications to work, you need to setup BPEL and connect WebCenter to your BPEL server.
Regards,
Rob -
How to relink Oracle binaries to new OS group assinged to oracle account
Hello,
Can someone tell us the steps how to relink oracle binaries to new OS group assinged to oracle account.
Regards,
Nikhil Jainalways post your questions with oracle version and operating name and version.
refer the link:-
http://oracle.erkansaka.org/2008/04/how-to-change-oracle-dba-group-in-unix.html
http://dbaforums.org/oracle/index.php?showtopic=7279
Thread: "change the DBA group" in a windows environment
"change the DBA group" in a windows environment -
How to display different text for labels in Group Above Report Oracle Repor
Hello,
Is there a way to change the text that is displayed in Labels in a Group Above Report? For example, I have a Group Above report with my columns of data and above the columns I have my column labels, but I would like to be able to display various text, i.e. different labels based on condition. In other words, Column1 label could say Column 1 or This is Column1, based on a condition. This is Oracle Report Builder 10.1.2.0.2.
Thank you.968277 wrote:
I'm thinking it is possible with a Format Trigger, but I've only ever returned (TRUE) or (FALSE). I am very new to Oracle Reports Builder. Thanks.Hi,
Yes it's possible. and your are in the right place. use this true and false. For example
/*true means display, false means don't display */
if your_criteria_or_condition is ok then
return (TRUE);
else
return (FALSE);
end if;create as many label as your need and control with the code..
Hope this works..
Hamid
Mark correct/helpful to help others to get right answer(s).* -
Not able to create a Volume Group in the oracle VM server installation
Hi,
I am installing Oracle VM server. In the installtion ( Partition time ), i click on create custom layout and i want to create a / partition as a logical volumn under volume group. But there is no option to create a Volume group actually. So can anybody help how to create a volume group actually and how to create a logical volume under volume group.user10274248 wrote:
So can anybody help how to create a volume group actually and how to create a logical volume under volume group.LVM is not recommended in Dom0, which is why support for LVM has been removed from the installer. LVM is not cluster aware and does not support write barriers, both of which are important for a filesystem that is used for storing file-backed disk images. -
Not a GROUP BY expression - Oracle 10g bug?
Hi,
I am geting 00979. 00000 - "not a GROUP BY expression" error on Oracle 10g 10.2.0.4.0 - 64bit Production.
To illustrate my problem I created following example.
Let think I have some shop with clothes. Everytime I sell something, I store this information in the database - storing actual time, clothes type (trousers, socks, ...) and the size of the piece (M, L, XL, ...).
Now, system counts statistics every hour. So it goes thrue the table with sold pieces and counts the number of pieces per clothes type and per size from the beginning of the day. It is important to realize that it is from the beginning of the day. Because of that, the number of sold pieces in the statistical table grows every hour (or is at least on the same value as in previous hour).
Now, from this statistical table I need to make new statistic. I want a statistic how many pieces per size I sold every hour.
I created this query for that:
SELECT TIME, xSIZE, (SOLD - NVL((SELECT SUM(S1.SOLD)
FROM STATISTICS S1
WHERE S1.xSIZE = S.xSIZE
AND TRUNC(S1.TIME, 'HH24') + 1/24 = S.TIME
AND TO_CHAR(S1.TIME, 'HH24') != '23'
AND S1.xSIZE IS NOT NULL
GROUP BY TRUNC(S1.TIME, 'HH24'), S1.xSIZE),0)) SOLD
FROM(
SELECT TRUNC(S.TIME, 'HH24') TIME, S.xSIZE, SUM(S.SOLD) SOLD
FROM STATISTICS S
WHERE S.xSIZE IS NOT NULL
GROUP BY TRUNC(S.TIME, 'HH24'), S.xSIZE
--ORDER BY 1 DESC
) S
ORDER BY TIME DESC, xSIZE ASCFirst I select number of sold pieces per hour per size. To get number of sold pieces for particular hour, I need to substract from this value number of sold pieces from previous hour. I decided to do this with parameter query...
Running the query like this I get "not a GROUP BY expression" error. However if I uncomment the "ORDER BY 1 DESC" statement, the query works. I am pretty sure it has to do something with this line:
AND TRUNC(S1.TIME, 'HH24') + 1/24 = S.TIME
If you modify this query like this:
SELECT TIME, xSIZE, (SOLD - NVL((SELECT SUM(S1.SOLD)
FROM STATISTICS S1
WHERE S1.xSIZE = S.xSIZE
--AND TRUNC(S1.TIME, 'HH24') + 1/24 = S.TIME
AND TO_CHAR(S1.TIME, 'HH24') != '23'
AND S1.xSIZE IS NOT NULL
GROUP BY S1.xSIZE),0)) SOLD
FROM(
SELECT TRUNC(S.TIME, 'HH24') TIME, S.xSIZE, SUM(S.SOLD) SOLD
FROM STATISTICS S
WHERE S.xSIZE IS NOT NULL
GROUP BY TRUNC(S.TIME, 'HH24'), S.xSIZE
--ORDER BY 1 DESC
) S
ORDER BY TIME DESC, xSIZE ASCRemoved joining the tables on truncated time and grouping by the truncated time -> The query does not fail...
And now the best...if you run the first query on Oracle 11g (Release 11.1.0.6.0 - 64bit Production), it works.
Does anybody know why is the first query not working on 10g? Is there some bug or limitation for this server version?
Please don't say me to rewrite the query in another way, I already did it, so it works on 10g as well. I am just curious why it doesn't work on 10g.
Finally here are some data for testing.
CREATE TABLE STATISTICS(
TIME DATE DEFAULT SYSDATE,
TYPE VARCHAR2(20),
xSIZE VARCHAR2(2),
SOLD NUMBER(5,0) DEFAULT 0
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 2/24, 'T-Shirt', 'M', 10);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 2/24, 'Socks', 'M', 3);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 2/24, 'T-Shirt', 'L', 1);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 2/24, 'Socks', 'L', 50);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 2/24, 'Trousers', 'XL', 7);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 2/24, 'Socks', 'XL', 3);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 1/24, 'T-Shirt', 'M', 13);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 1/24, 'Socks', 'L', 60);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 1/24, 'Trousers', 'XL', 15);
INSERT INTO STATISTICS(TIME, TYPE, xSIZE, SOLD) VALUES(SYSDATE - 1/24, 'Socks', 'XL', 6);Edited by: user12047225 on 20.9.2011 23:12
Edited by: user12047225 on 20.9.2011 23:45It is a known issue when optimizer decides to expand in-line view. You can add something (besides ORDER BY you already used) to in-line view to prevent optimizer from expanding it. For example:
SQL> SELECT TIME,
2 xSIZE,
3 (SOLD - NVL(
4 (
5 SELECT SUM(S1.SOLD)
6 FROM STATISTICS S1
7 WHERE S1.xSIZE = S.xSIZE
8 AND TRUNC(S1.TIME, 'HH24') + 1/24 = S.TIME
9 AND TO_CHAR(S1.TIME, 'HH24') != '23'
10 AND S1.xSIZE IS NOT NULL
11 GROUP BY TRUNC(S1.TIME, 'HH24'),
12 S1.xSIZE
13 ),
14 0
15 )
16 ) SOLD
17 FROM (
18 SELECT TRUNC(S.TIME, 'HH24') TIME,
19 S.xSIZE,
20 SUM(S.SOLD) SOLD
21 FROM STATISTICS S
22 WHERE S.xSIZE IS NOT NULL
23 GROUP BY TRUNC(S.TIME, 'HH24'),
24 S.xSIZE
25 --ORDER BY 1 DESC
26 ) S
27 ORDER BY TIME DESC,
28 xSIZE ASC
29 /
SELECT TRUNC(S.TIME, 'HH24') TIME,
ERROR at line 18:
ORA-00979: not a GROUP BY expression
SQL> SELECT TIME,
2 xSIZE,
3 (SOLD - NVL(
4 (
5 SELECT SUM(S1.SOLD)
6 FROM STATISTICS S1
7 WHERE S1.xSIZE = S.xSIZE
8 AND TRUNC(S1.TIME, 'HH24') + 1/24 = S.TIME
9 AND TO_CHAR(S1.TIME, 'HH24') != '23'
10 AND S1.xSIZE IS NOT NULL
11 GROUP BY TRUNC(S1.TIME, 'HH24'),
12 S1.xSIZE
13 ),
14 0
15 )
16 ) SOLD
17 FROM (
18 SELECT TRUNC(S.TIME, 'HH24') TIME,
19 S.xSIZE,
20 SUM(S.SOLD) SOLD,
21 ROW_NUMBER() OVER(ORDER BY SUM(S.SOLD)) RN
22 FROM STATISTICS S
23 WHERE S.xSIZE IS NOT NULL
24 GROUP BY TRUNC(S.TIME, 'HH24'),
25 S.xSIZE
26 --ORDER BY 1 DESC
27 ) S
28 ORDER BY TIME DESC,
29 xSIZE ASC
30 /
TIME XS SOLD
20-SEP-11 L 9
20-SEP-11 M 0
20-SEP-11 XL 11
20-SEP-11 L 51
20-SEP-11 M 13
20-SEP-11 XL 10
6 rows selected.
SQL> Or use subquery factoring (WITH clause) + undocumented hint MATERIALIZE:
SQL> WITH S AS (
2 SELECT /*+ MATERIALIZE */ TRUNC(S.TIME, 'HH24') TIME,
3 S.xSIZE,
4 SUM(S.SOLD) SOLD
5 FROM STATISTICS S
6 WHERE S.xSIZE IS NOT NULL
7 GROUP BY TRUNC(S.TIME, 'HH24'),
8 S.xSIZE
9 --ORDER BY 1 DESC
10 )
11 SELECT TIME,
12 xSIZE,
13 (SOLD - NVL(
14 (
15 SELECT SUM(S1.SOLD)
16 FROM STATISTICS S1
17 WHERE S1.xSIZE = S.xSIZE
18 AND TRUNC(S1.TIME, 'HH24') + 1/24 = S.TIME
19 AND TO_CHAR(S1.TIME, 'HH24') != '23'
20 AND S1.xSIZE IS NOT NULL
21 GROUP BY TRUNC(S1.TIME, 'HH24'),
22 S1.xSIZE
23 ),
24 0
25 )
26 ) SOLD
27 FROM S
28 ORDER BY TIME DESC,
29 xSIZE ASC
30 /
TIME XS SOLD
20-SEP-11 L 9
20-SEP-11 M 0
20-SEP-11 XL 11
20-SEP-11 L 51
20-SEP-11 M 13
20-SEP-11 XL 10
6 rows selected.
SQL> SY. -
Grouping error in Oracle's analytic function PERCENTILE_CONT()
Hi,
I have a question regarding the usage of Oracle's analytic function PERCENTILE_CONT(). The underlying time data in the table is of hourly granularity and I want to fetch average, peak values for the day along with 80th percentile for that day. For the sake of clarification I am only posting relevant portion of the query.
Any idea how to rewrite the query and achieve the same objective?
SELECT TRUNC (sdd.ts) AS ts,
max(sdd.maxvalue) AS max_value, avg(sdd.avgvalue) AS avg_value,
PERCENTILE_CONT(0.80) WITHIN GROUP (ORDER BY sdd.avgvalue ASC) OVER (PARTITION BY pm.sysid,trunc(sdd.ts)) as Percentile_Cont_AVG
FROM XYZ
WHERE
XYZ
GROUP BY TRUNC (sdd.ts)
ORDER BY TRUNC (sdd.ts)
Oracle Error:
ERROR at line 5:
ORA-00979: not a GROUP BY expressionYou probably mixed up the aggregate and analytical versin of PERCENTILE_CONT.
The below should work, but i dont know if it produces the desireed results.
SELECT TRUNC (sdd.ts) AS ts,
max(sdd.maxvalue) AS max_value, avg(sdd.avgvalue) AS avg_value,
PERCENTILE_CONT(0.80) WITHIN GROUP (ORDER BY sdd.avgvalue ASC) as Percentile_Cont_AVG
FROM XYZ
sorry, what is this where clause for??
WHERE
XYZ
GROUP BY TRUNC (sdd.ts)
ORDER BY TRUNC (sdd.ts) Edited by: chris227 on 26.03.2013 05:45 -
We have to use a group by into a request from an oracle database :
SELECT SUBSTR(ETETAFI,0,6)
||'0'
||' '
||' '
||MAX(SUBSTR(ETETAFI,13,35))
||RPAD(TO_CHAR(SUM(TO_NUMBER(SUBSTR(ETETAFI,48,16)))),16,' ')
||RPAD(TO_CHAR(SUM(TO_NUMBER(SUBSTR(ETETAFI,64,16)))),16,' ')
||RPAD(TO_CHAR(SUM(TO_NUMBER(SUBSTR(ETETAFI,80,16)))),16,' ')
||RPAD(TO_CHAR(SUM(TO_NUMBER(SUBSTR(ETETAFI,96,16)))),16,' ')
FROM JDEDATA900.F7409FOW GROUP BY SUBSTR(ETETAFI,0,6)
Do you know how to do that as the table JDEDATA900.F7409FOW is our source.
Thanks.To use GROUP BY, when you map any column with an aggregate function, ODI will automatically generate a group by on all other columns which are mapped, but without an aggregate function.
-
Cannot create ASM disk groups in DBCA - Oracle 11gR1, Windows 32bit
Good afternoon,
Using 11gR1 on Windows XP, I need help installing a database (single instance) using ASM, I am not able to select disks to be stamped for use by ASM. I have done the following steps:
1. Installed the Oracle 11gR1 software (no database created - just the software)
2. Connected nine (9) SCSI hard drives to the system
3. Created a primary partition on each hard drive, formatted the partition but did *not* assign a drive letter
4. Created a listener service (working properly - checked with lsnrctl status)
5. Started DBCA to create a single database instance using ASMIn DBCA I performed the following:
a. at the welcome screen, click Next
b. at "Step 1 of 16", click Next (accepting the default "Create a Database")
c. at "Step 2 of 16", click Next (accepting the default "General Purpose or Transaction Processing)
d. at "Step 3 of 16", "Global Database Name" set to "dbca", "SID" set to "dbca", click Next
e. at "Step 4 of 16", click Next (accepting the defaults)
f. at "Step 5 of 16", click "Use same administrative passwords for all accounts" and entered password, click Next
g. at "Step 6 of 16", click "Automatic Storage Management (ASM)", click Next
Everything seems just fine until I reach the following step
h. at "Step 7 of 16", click "Create New"
- The Create Disk Group window pops up (there is nothing shown in the "Select Member Disk Area")
- set the "Disk Group Name" to "DATAGROUP"
- click on "Show All" (no devices shown after clicking)
- click on "Stamp Disks..." this causes the "asmtool operation" window to pop up
- click on "Add or change label", click on Next
- the "Select Disks" step appears. There are 11 hard drives listed but NONE of them
can be selected - all I can do here is click on Cancel*The question:* Why aren't the drives selectable and what do I need to do to make them selectable ?
Thank you very much for your help,
John.>
The question: Why aren't the drives selectable and what do I need to do to make them selectable ?
>
To answer my own question (now that I've figured it out), the reason is because the partition should not be formatted.
When Windows displays the "New Partition Wizard", it is important to:
1. not assign a drive letter
2. and select "Do not format this partition"
This will cause Windows to mount the volume thus making it accessible to Oracle.
Hopefully this will help someone not fall in this trap as I did,
John. -
Oinstall group permissions under Oracle Linux
Hello,
From what I understand according to the Oracle 11gR2 installation documentation, the purpose of the "oinstall" group is to have an additional OS group that can maintain the Oracle software installation beside the "oracle" user.
The instructions outline to set the mount point of the Oracle installation to owner "oracle" and group "oinstall" with full privileges for owner and group, except world (775). Any other user who belongs to the OSDBA (dba) group will only need read and execute permissions on the Oracle home directory.
The "orainstRoot.sh" post installation script then sets permissions 770 on the oraInventory directory to remove world access and set read, write and execute for owner and group.
But what why are the privileges for the Oracle home set to 755? How can I maintain the software using the "oinstall" group if it does not have write privileges? If I need to patch the software using the Oracle user account, what can I do with the "oinstall" group?
Thanks and kind regards.i think I can answer the question myself. There could be different oracle home installations, each with a different oracle user/owner like "oracle_prod1" and "oracle_prod2", but both users must be able to read/write the shared oraInventory, in which case both users must have read and write access to the oraInventory directory, hence the oinstall group.
-
Can we have a group name in oracle database???
Hello,
what i want to know is that can we have a group name, a set of all usernames for a database,
the whole purpose is to simplify the grant statement, rather then doing this
grant select to <user1>
grant select to <user2>
grant select to <user3>
it would be simple to do
grant select to <group1>
where group1 consists of user1,user2 and user3...
cheereall_users
describe all_users
Name Null? Type
USERNAME NOT NULL VARCHAR2(30)
USER_ID NOT NULL NUMBER
CREATED NOT NULL DATE -
How to use Pivot function for group range in oracle SQL
Hi,
Good Morning !!!
I need to show the data in the below format. There is 2 columns 1 is State and another one is rate.
State <100 100-199 200-299 300-399 400-499 500-599 600-699 700-799 800-899 900-999 >=1000 Total
AK 1 2 0 4 1 4 4 35 35 4 1 25
AL 0 0 2 27 10 17 35 2 2 35 0 103
AR 0 0 1 0 0 2 2 13 13 2 0 6
AZ 0 1 2 14 2 14 13 3 3 13 0 57
CA 0 0 1 6 2 7 3 4 4 3 0 34
Developed the below query but unable to use the range on pivot function . Please help on this.
(select (SELECT SHORT_DESCRIPTION
FROM CODE_VALUES
WHERE CODE_TYPE_CODE = ad.STATE_TYPE_IND_CODE
AND VALUE = ad.STATE_CODE
) STATE,
nr.rate
FROM neutrals n,
contacts c,
addresses ad,
xref_contacts_addresses xca,
neutral_rates nr
where n.contact_id=c.contact_id
and n.address_id = ad.address_id
and xca.address_id=ad.address_id
and xca.contact_id=c.contact_id
and nr.contact_id = n.contact_id
and nr.rate_frequency='HOUR' )user8564931 wrote:
This solutions is useful and Thanks for your reply.
How can i get the Min value and Max value for each row ?
State <100 100-199 200-299 300-399 400-499 500-599 600-699 700-799 800-899 900-999 >=1000 Total Min Max
IL 0 0 1 5 1 5 40 1 1 40 0 53 $10 $2,500
IN 0 0 0 0 0 0 1 49 49 1 0 3 $70 $1,500This?
WITH t AS
(SELECT 'AL' state, 12 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 67 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 23 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 12 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 12 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 78 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 34 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 4 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 12 VALUE FROM DUAL
UNION ALL
SELECT 'AL' state, 15 VALUE FROM DUAL
UNION ALL
SELECT 'AZ' state, 6 VALUE FROM DUAL
UNION ALL
SELECT 'AZ' state, 123 VALUE FROM DUAL
UNION ALL
SELECT 'AZ' state, 123 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 23 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 120 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 456 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 11 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 24 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 34 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 87 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 23 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 234 VALUE FROM DUAL
UNION ALL
SELECT 'MA' state, 789 VALUE FROM DUAL
UNION ALL
SELECT 'MH' state, 54321 VALUE FROM DUAL),
-- End of test data
t1 AS
( SELECT state,
NVL (COUNT (DECODE (VALUE, 0, 0)), 0) "<100",
NVL (COUNT (DECODE (VALUE, 1, 1)), 0) "100-199",
NVL (COUNT (DECODE (VALUE, 2, 2)), 0) "200-299",
NVL (COUNT (DECODE (VALUE, 3, 3)), 0) "300-399",
NVL (COUNT (DECODE (VALUE, 4, 4)), 0) "400-499",
NVL (COUNT (DECODE (VALUE, 5, 5)), 0) "500-599",
NVL (COUNT (DECODE (VALUE, 6, 6)), 0) "600-699",
NVL (COUNT (DECODE (VALUE, 7, 7)), 0) "700-799",
NVL (COUNT (DECODE (VALUE, 8, 8)), 0) "800-899",
NVL (COUNT (DECODE (VALUE, 9, 9)), 0) "900-999",
NVL (COUNT (DECODE (VALUE, 10, 10)), 0) ">=1000"
FROM (SELECT state,
CASE
WHEN VALUE < 100 THEN 0
WHEN VALUE BETWEEN 100 AND 199 THEN 1
WHEN VALUE BETWEEN 200 AND 299 THEN 2
WHEN VALUE BETWEEN 300 AND 399 THEN 3
WHEN VALUE BETWEEN 400 AND 499 THEN 4
WHEN VALUE BETWEEN 500 AND 599 THEN 5
WHEN VALUE BETWEEN 600 AND 699 THEN 6
WHEN VALUE BETWEEN 700 AND 799 THEN 7
WHEN VALUE BETWEEN 800 AND 899 THEN 8
WHEN VALUE BETWEEN 900 AND 999 THEN 9
WHEN VALUE >= 1000 THEN 10
END
VALUE
FROM t)
GROUP BY state)
SELECT STATE,
"<100",
"100-199",
"200-299",
"300-399",
"400-499",
"500-599",
"600-699",
"700-799",
"800-899",
"900-999",
">=1000",
"<100"
+ "100-199"
+ "200-299"
+ "300-399"
+ "400-499"
+ "500-599"
+ "600-699"
+ "700-799"
+ "800-899"
+ "900-999"
+ ">=1000"
total,
least("<100",
"100-199",
"200-299",
"300-399",
"400-499",
"500-599",
"600-699",
"700-799",
"800-899",
"900-999",
">=1000") min_val,
greatest("<100",
"100-199",
"200-299",
"300-399",
"400-499",
"500-599",
"600-699",
"700-799",
"800-899",
"900-999",
">=1000") max_val
FROM t1
/ -
How to find grouping data in oracle
table a
mob_no,call_start_time,call_end_time,cgi_id_key
table b
cgi_id_key,latitude,longitude
i want to find out data
from
table a,table b
select
a( mob_no,call_start_time,call_end_time),
b(latitude,longitude)
join_cluse
cgi_id_key
group by clause
served_msisdn
having
count(*) > 2
order by
call_start_timewell, if you knew where served_msisdn came from, you'd be done. you've basically written the entire rest of the query.
-
Alternative to Group by in oracle 9i
Dear All;
I currently have a query which is generating 10,000 rows but when I try applying a simple group by it affects the performance of the query. Hence, is there an alternative to using group by. Thank you.but when I try applying a simple group by it affects the performance of the query.If you could show us the query + execution plan with and without the group by, we could have suggestions...
Adding a GROUP BY to a query that performs nicely, will of course add some additional required cpu processing, but shouldn't necessarily have to change the way the rows that need to be grouped are retrieved. -
Does GROUP BY force oracle go for sorting?
Version : 10.2
I usually rewrite all queries with DISTINCT clause to GROUP BY to avoid sorting in the temporary tablespace. But, doesn't GROUP BY queries go for sorting?Hi,
I am on 10.2.0.1
SQL> alter system flush shared_pool;
System altered.
SQL> alter system flush buffer_cache;
System altered.
SQL> select deptno from emp group by deptno;
DEPTNO
30
20
10
Execution Plan
Plan hash value: 4067220884
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 9 | 4 (25)| 00:00:01 |
| 1 | HASH GROUP BY | | 3 | 9 | 4 (25)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMP | 14 | 42 | 3 (0)| 00:00:01 |
Statistics
335 recursive calls
0 db block gets
64 consistent gets
21 physical reads
0 redo size
456 bytes sent via SQL*Net to client
381 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
3 rows processed
SQL> alter system flush shared_pool;
System altered.
SQL> alter system flush buffer_cache;
System altered.
SQL> select distinct deptno from emp;
DEPTNO
30
20
10
Execution Plan
Plan hash value: 3709190377
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 9 | 4 (25)| 00:00:01 |
| 1 | HASH UNIQUE | | 3 | 9 | 4 (25)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMP | 14 | 42 | 3 (0)| 00:00:01 |
Statistics
754 recursive calls
0 db block gets
145 consistent gets
31 physical reads
0 redo size
456 bytes sent via SQL*Net to client
381 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
17 sorts (memory)
0 sorts (disk)
3 rows processedhmm,group by does sort but distinct seems to be more expensive w.r.t sorting.
Maybe you are looking for
-
Hello i have what I think is a first generation Ipod touch which did not come with the App store already downloaded onto it, can I not download apps to my Ipod touch?
-
How to read multiple Digital samples and plot a chart with time stamps
Hi, Could anyone send me a code that: 1. Reads 'multiple samples(lets say 4) from single digital input' 2. 'plot digital data as a chart with time stamps' 3. Find frequency 4. Log data into file with time stamps I have attached the code which i tri
-
Photo Stream not working anymore
I had PhotoStream working on my iMac, iPad and iPhone. It has stopped working. All boxes to turn it on are checked 'yes'. When I try to share to Photo Stream, nothing happens but it says 'photos uplodaing'. In my iCloud account there is no Photo Stre
-
Progress with stability in vista x64 ?
has the developer gained any ground with regard to fixing stability issues when itunes is running ? i've tried a variety of things, including turning off other software, but still itunes freezes randomly...
-
Accordion panel-change color to gradient?
Hi, I have a question regarding designing the accordion tabs. I made an accordion panel on our website, however I found the tabs boring just to be plain gray. Does anybody know how to make the tabs background to be gradient? Thank you so much for you