Few days ago, I came to a problem where I have to sum the value of some duplicate row in MySql & I've tried some queries but they didn't work.
Here is table data :-
card_id tic_id game_id card_symbol card_symbol_no qty
1 6 1 C 6 2
2 6 1 H 7 6
3 6 1 C 6 7
And My desired output is :-
card_id tic_id game_id card_symbol card_symbol_no qty
1 6 1 C 6 (9)
2 6 1 H 7 (6)
some other given factor :-
1.) the "tic_id", & "game_id" is same.开发者_运维技巧select
min(card_id) as card_id,
tic_id,
game_id,
card_symbol,
card_symbol_no,
sum(qty) as qty
from
yourTabel
group by
tic_id,
game_id,
card_symbol,
card_symbol_no
精彩评论