add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE table1 (id int, grp int, `number` int);
INSERT INTO table1 (id, grp, `number`) VALUES (1,1, 10), (2, 1, 10), (3, 1, 10), (4, 2, 30), (5, 3, 20);
SELECT grp, sum(number) as f
FROM table1
GROUP BY grp
grp f
1 30
2 30
3 20
SELECT
sum(number) as f
FROM
table1
f
80
SELECT sum(`number`) as f
FROM (SELECT DISTINCT `grp`, `number` FROM table1) g

f
60