0

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

2
Contributors
4
Replies
13
Views
3 Years
Discussion Span
Last Post by hemanshurpatel
0

Hi Pritaeas

Are you sugegsting...

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

It doesnt seems working.

Edited by pritaeas: Added code markdown.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.