Hi

I have a mysql table in which 3 columns are of main interest.
I want to final output like, if two columns matches(of different rows) then third columns should be sum of two columns.

Example

column1 column2 column3

abc hiren 5
bcd host 10
cde ketan 13
abc hiren 6
bcd game 2

Output Should be

abc hiren 11
bcd game 2
bcd host 10
cde ketan 13

See in above case two rows, row 1 and 4 whose first two column matches, then their column3 is added to generate final value.

What should be mysql query for this?

Hemanshu

Hi Pritaeas

Are you sugegsting...

SELECT  column1, column2, SUM(COLUMN3) GROUP BY column1 AND GROUP BY column2;

It doesnt seems working.

Ohh
Thank you very much Pritaeas

It worked.
Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.