Introducing the all-new TIBCO Community site!

For current users, please click "Sign In" to reset your password and access the enhanced features. If you're a first-time visitor, we extend a warm welcome—click "Sign Up" to become a part of the TIBCO Community!

If you're seeking alternative community sites, explore ibi, Jaspersoft, and Spotfire.

Jump to content

How to merge rows with the same value


Recommended Posts

hi everybody, i would like to merge rows that have the same value. Otherwise, do the sum for the same values.

For exemple, I've got two colums :

- fruit

-price

if there is same values in row in fruit column, i want to merge them and to sum the values prices corresponding to the fruit column

I will want to merge the rows with the same value in the fruit column and add the corresponding values in the price column into a single box. Basically, group a value if the fruits are the same.

I hope i was clear.

thank you in advance.

Link to comment
Share on other sites

In the SQL Query, you can specify a 'GROUP BY' clause.  What TIBCO Product are you asking this about

 

But this query, below, is illegal now in the current versions of MySql. The 2nd select expression, f.price, is a non-aggregate. which price

 

SELECT f.name, f.price
 FROM fruit_table f
GROUP BY f.name

 

Each expression needs to either be referenced in the GROUP BY clause, or used in an aggregate function, as below:

 

SELECT f.name, SUM(f.price)
 FROM fruit_table f
GROUP BY f.name

 

MySQL 8.0 Reference Manual

 

Aggregate Function Descriptions

MySQL Handling of GROUP BY

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...