ERROR at line 1: ORA-00979: not a GROUP BY expression Answer You are getting this error for WEIGHT_IN_PERCENTAGE. If WEIGHT_IN_PERCENTAGE is same for every row in a group you can use (SUM(POINTS) * max(WEIGHT_IN_PERCENTAGE)) or you can SUM(POINTS*WEIGHT_IN_PERCENTAGE) multiply it with POINTS before sum: OR

# Tag: aggregation

## Can I get the full rows when using group by multiple columns?

If the date, item, and category are the same in the table, I’d like to treat it as the same row and return n rows out of them(ex: if n is 3, then limit 0, 3). expected results (if n is 3) The problem is that I have to bring the values of each group as well. If I have

## using FETCH clause is not allowed in mysql .what alternative to be used instead

hi I have 2 tables want to use aggregation and having cluse. can u plz check my query? does not work Answer The nested aggregation MAX(SUM(registration.RegFeeAmntPaid)) is the problem: Nested aggregations are not allowed in SQL: After the first aggregation, there is only one value. Thus, aggregating again does not make sense. (In Oracle, under SELECT of a GROUP BY

## Tag a row based on aggregate value condition

Here is my dataset, where order is the fix sequence of each product. What I want is another column in here, lets say TagID. TagID is an int value that will based on the aggregate Count column, group it by product if it is greater or equal to 5. So the dataset would look like this: How can I accomplish

## Failed to breakup Windowing invocations into Groups. At least 1 group must only depend on input columns

I have a dataset with booking hotels. date_in has format “yyyy-MM-dd”. I need select top 10 the most visited hotel by month. I get the following error: Error: Error while compiling statement: FAILED: SemanticException Failed to breakup Windowing invocations into Groups. At least 1 group must only depend on input columns. Also check for circular dependencies. Underlying error: org.apache.hadoop.hive.ql.parse.SemanticException: Line

## How does Impala Implements GroupBy Extension(CUBE, ROLLUP and GROUPING SETS) In a distributed way?

I’m Learning how to Implement GroupBy Extension(CUBE, ROLLUP and GROUPING SETS), I’ve watched at FE several times, But I still can’t understand how to use grouping_ids to implement GroupBy Extension throught collaboration with BE in a distributed way.How is it to collaborition with ExchangeNode? Is it collaborition with ExchangeNode? Can someone help me with the maze？ Answer Impala introduced the

## Multiple aggregate calculations using Group by

I have a dataset, df1, where I would like to: Take the average of the TotalB column based upon grouping the TotalB column. I would then like to take this new column and subtract the free value to …

## How to merge more than two select queries to single result set in oracle

I need to merge the result set of four queries into single result output. Example: I need the output in the below format Answer One option would be applying Conditional Aggregation during joining of the tables :

## Is it possible to improve the performance of this subquery?

For my application I have a topic table and a vote table. The vote options are -1, 0, and 1. I’m trying to find the amount of times each topic was voted -1 and 1. So to find out, I am doing many …

## how to compute percentage in mysql/sql when 2 group by conditions are present

id title count organizer 1 music 4 2 2 sports 6 2 3 music 2 3 I have a derived table with the above structure. I need to compute the percentage of the number of events of each …