mysql - How to count values from column whilst taking into account a qty column -
i've seen other questions never column used
say i've got table
name | qty nup 1 foo 1 foo 3 tup 2 foo 1 nup 4
in example ge result like
name | qty foo 5 tup 2 nup 5
at moment have done not take account qty
$sql = "select `name`,count(*) count orders group `name` order count desc";
try this
$sql = "select name, sum(qty) qty orders group name order qty desc";