I’m pretty new in the SQL world and i have some troubles about counting some row. I explain myself:
I have a DB like this:
x
NAME | (somenumbers)|
L1 | 2
L1 | 2
L2 | 3
L3 | 1
L3 | 1
L3 | 1
I expected result like this [L1:4,L2:3,L3:3], i have tried to read and test some count, group by or distinct but I am missing something. So if some people can help me, i would appreciate.
Advertisement
Answer
use sum()
instead count()
select name,sum(somenumbers) from table_name
group by name