Avatar of Flex Tron
Flex Tron
Flag for United States of America asked on

Group By function in Oracle

Hi Team,
I am trying to use a simple Group by code as shown, ...But don't need to do a Group BY on ISIN..(Varchar)...But when I remove that...I get error saying not a Groupby function...Can I just do a group by based on first two columns. ?


select distinct G.CLIENT_ID,G.YEARMONTH, D.ISIN,SUM(G.ACCOUNT_CBV) as ACCOUNT_CBV, SUM(G.TOTAL_REVENUES) as TOTAL_REVENUES from GMIS G, DEPOT D 
where G.CLIENT_ID = D.CLIENT_ID 
GROUP BY G.CLIENT_ID,G.YEARMONTH,D.ISIN order by Client_ID;

Open in new window

Oracle Database

Avatar of undefined
Last Comment
Flex Tron

8/22/2022 - Mon
SOLUTION
Sean Stuber

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Haris Dulic

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sean Stuber

using two queries on the same table is needlessly expensive, even if there are indexes

also, using a left join changes the functionality of the query
Flex Tron

ASKER
The Issue is that the tables have different levels of granularity. In that way, it's always challenging. Will keep researching on this...but sure the answers help a ton.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23