I have a table in mysql like below :
Table name : Emp
Emp Name | Time
_______________
ABC | 1
ABC | 2
ABC | 3
PQS | 4
XYZ | 5
I want the output as below
Emp Name | Time
_______________
ABC | 6
PQS | 4
XYZ | 5
As you can see only the unique Emp names are returned and the time is added for each instance of Emp name.
This is a rudimentary aggregate
SUM()grouping byEmp Name:Review the MySQL documentation on aggregate functions and the use of
GROUP BYclauses.Note, if your column name is actually
Emp Namewith the space, you will need to quote it with backticks as in: