The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now!
A chart showing the TIBCO Platform vision
Jump to content
Forums
Ask questions and gain insight from discussions

How to merge rows with the same value


Matthieu Solle

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...