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

Use a GROUP BY on the two columns and use SUM to get the final value.

Hi Pritaeas

Are you sugegsting...

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

It doesnt seems working.

Almost.

SELECT column1, column2, SUM(column3) GROUP BY column1, column2

Ohh
Thank you very much Pritaeas

It worked.
Thank you very much.