-6

I try it, but didn't output like i want.

Example:

I have table like this :

+----+------+------+
| Id | Name | Total|
+----+------+------+
|  1 | Joni |   2  |
|  2 | Brad |   1  |
|  3 | Joni |   3  |
|  4 | Chuck|   1  |
|  5 | Brad |   3  |
|  6 | Brad |   5  |
+----+------+------+

And i want output like this :

+------+------+
| Name | Total|
+------+------+
| Joni |   5  |
| Brad |   9  |
| Chuck|   1  |
+------+------+
* Count total by Distinct name


Thank you.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Haruaki
  • 1
  • 1

1 Answers1

1

You can make your query like this for getting same result that you want -

SELECT SUM(Total) as total,Name from table_name group by Name;
Hitesh Kumar
  • 383
  • 2
  • 6