I am trying to summarize the values of strings, two of which have duplicate values, table below:
Table Name (Clients)
value years total
1 30 30
3 10 10
4 15 15
4 25 25
Ideally, I would like to finally:
value years total
1 30 30
3 10 10
4 40 40
I tried to use SELECT DISTINCTand GROUP BYto get rid of the duplicate line, the connection in the code below is also not required. Despite the fact that both teams to no avail. Here is also my code:
SELECT DISTINCT
value,
years,
SUM(customer.years) AS total
FROM customer
INNER JOIN language
ON customer.expert=language.l_id
GROUP BY
expert,
years;
But this creates a copy of the first table, any input is welcome. Thanks!!!
user3056153
source
share