i have table like
id Name Taste price Qty
1 Hot-Dog Spicy 500 3
2 Pop-Corn Caramel 400 2
3 Hot-Dog Non-Spicy 600 1
4 Hot-Dog Spicy 520 4
5 Pop-Corn Salty 350 5
how to make a return row
Name Taste price Qty
Hot-Dog Spicy 520 7 <--- Group by name and taste, sum(qty), with lastest price
Pop-Corn Caramel 400 2
Hot-Dog Non-Spicy 600 1
Pop-Corn Salty 350 5
$sql = mysqli_query($con,"SELECT *,sum(qty) as qtys FROM sometable GROUP BY name,taste");
simply word.. return group by name and taste with "lastest price(biggest id) from same item" and sum(qty)
how to get lastest price. i try min(),max() it return smallest or biggest value.