By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE Events(
EventID int,
EventName varchar(20),
EventTime numeric(17,6)
);
INSERT INTO Events VALUES (1, 'Event1_Start', 0.2);
1 rows affected
INSERT INTO Events VALUES (2, 'Event2_Start', 0.3);
1 rows affected
INSERT INTO Events VALUES (3, 'Event3_End', 0.2);
1 rows affected
INSERT INTO Events VALUES (4, 'Event2_End', 0.6);
1 rows affected
INSERT INTO Events VALUES (5, 'Event4_Start', 0);
1 rows affected
INSERT INTO Events VALUES (2, 'Event2_Start', 0.3);
1 rows affected
INSERT INTO Events VALUES (6, 'Event1_End', 0);
1 rows affected
select substr(eventname, 1, 6), sum(eventtime) from events group by substr(eventname, 1,6)
SUBSTR(EVENTNAME,1,6) | SUM(EVENTTIME) |
---|---|
Event2 | 1.2 |
Event4 | 0 |
Event3 | .2 |
Event1 | .2 |