By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE loadtimes (`ms` INTEGER, `version` VARCHAR(10), `buildings` INTEGER);
INSERT INTO loadtimes VALUES
('10', '22.5.1-0.4', '1'),
('5', '22.5.2-1.1', '1'),
('2', '22.5.2-1.1', '1'),
('20', '22.5.1-0.4', '2'),
('4', '22.5.1-0.4', '2'),
('30', '22.5.2-1.1', '2'),
('70', '22.5.1-0.4', '3'),
('6', '22.5.2-1.1', '3');
SELECT buildings,
AVG(CASE WHEN version = '22.5.1-0.4' THEN ms END) AS "Version 22.5.1-0.4",
AVG(CASE WHEN version = '22.5.2-1.1' THEN ms END) AS "Version 22.5.2-1.1"
FROM loadtimes
GROUP BY buildings;
buildings | Version 22.5.1-0.4 | Version 22.5.2-1.1 |
---|---|---|
1 | 10 | 3.5 |
2 | 12 | 30 |
3 | 70 | 6 |