I have data like this :
Name | Value |
---|---|
German | 4 |
French | 1 |
FrenchSecond | 1 |
English | 2 |
With SQL, I want to merge manually (French and FrenchSecond) and sum the "Value" :
Name | Value |
---|---|
German | 4 |
French | 2 |
English | 2 |
CodePudding user response:
You may use a CASE
expression for this purpose:
SELECT CASE WHEN Name LIKE 'French%' THEN 'French' ELSE Name END AS Name,
SUM(Value) AS Value
FROM yourTable
GROUP BY CASE WHEN Name LIKE 'French%' THEN 'French' ELSE Name END;