I need to merge 2 records into one.
Mine table:
╔═════╦═══════╦═════╦═══════╗
║ id* ║ name ║price║ rank ║
╠═════╬═══════╬═════╬═══════╣
║ 0 ║ A ║ 12 ║ CAP ║
║ 1 ║ B ║ 32 ║ BAC ║
║ 2 ║ B ║ 13 ║ BAC ║
╚═════╩═══════╩═════╩═══════╝
and after merge (same table NOT SELECT)
╔═════╦═══════╦═════╦═══════╗
║ id* ║ name ║price║ rank ║
╠═════╬═══════╬═════╬═══════╣
║ 0 ║ A ║ 12 ║ CAP ║
║ 1 ║ B ║ 45 ║ BAC ║
╚═════╩═══════╩═════╩═══════╝
looking for records that name, and rank is the same like one another and SUM price.
Merge database, and REMOVE second duplicated record.
I need to make it using Join statement or is there any faster method to do this?