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` INTEGER,
`colour` VARCHAR(6),
`item` VARCHAR(7)
);

INSERT INTO table1
(`id`, `colour`, `item`)
VALUES
('1', 'blue', 'anorak'),
('2', 'blue', 'jeans'),
('3', 'green', 't-shirt'),
('4', 'yellow', 't-shirt');

CREATE TABLE table2 (
`id` INTEGER,
`cost` INTEGER
);

INSERT INTO table2
(`id`, `cost`)
VALUES
('1', '58'),
('2', '22'),
('3', '36'),
('4', '19');
SELECT SUM(cost) FROM table1 t1 INNER JOIN table2 t2 ON t1.id = t2.id WHERE colour='blue';
SUM(cost)
80