MySQL Group By and Sum total value of other column
Remove the single quote around the WORD
. It causes the column name to be converted as string.
SELECT word, SUM(amount)
FROM Data
Group By word
It should be grave accent symbol not single quote:
SELECT word, SUM( amount )
FROM Data
GROUP BY `word`;
Output:
word SUM(amount)
dog 6
Elephant 2