clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1716861 fiddles created (23937 in the last week).

CREATE TABLE test1 ( `tID` INT(11) NULL DEFAULT NULL, `tDate` DATE NULL DEFAULT NULL, `tName` VARCHAR(50) NULL DEFAULT NULL, `tType` VARCHAR(50) NULL DEFAULT NULL, `tAction` VARCHAR(50) NULL DEFAULT NULL );
 hidden batch(es)


INSERT INTO test1 VALUES (1, '2019-02-01', 'Bob', 'a', 'Create'),(2, '2019-02-02', 'Frank', 'a', 'Create'), (3, '2019-02-03', 'Jim', 'b', 'Create'), (4, '2019-02-04', 'Frank', 'a', 'Delete'), (5, '2019-02-05', 'Bob', 'b', 'Create'),(6, '2019-02-06', 'Bob', 'a', 'Delete'), (7, '2019-02-07', 'Bob', 'a', 'Create'),(8, '2019-02-08', 'Frank', 'b', 'Create'), (9, '2019-02-09', 'Bob', 'b', 'Delete'),(10, '2019-02-10', 'Bob', 'b', 'Create'), (11, '2019-02-11', 'kate', 'a', 'Create'), (12, '2019-02-12', 'kate', 'a', 'Delete');
 hidden batch(es)


select * from test1 a order by tname, ttype
tID tDate tName tType tAction
1 2019-02-01 Bob a Create
6 2019-02-06 Bob a Delete
7 2019-02-07 Bob a Create
5 2019-02-05 Bob b Create
9 2019-02-09 Bob b Delete
10 2019-02-10 Bob b Create
2 2019-02-02 Frank a Create
4 2019-02-04 Frank a Delete
8 2019-02-08 Frank b Create
3 2019-02-03 Jim b Create
11 2019-02-11 kate a Create
12 2019-02-12 kate a Delete
 hidden batch(es)


select * from test1 a where a.taction='Create' and not exists (select 1 from test1 b where a.tname=b.tname and a.ttype=b.ttype and a.tdate<b.tdate and b.taction<>'Create' )
tID tDate tName tType tAction
3 2019-02-03 Jim b Create
7 2019-02-07 Bob a Create
8 2019-02-08 Frank b Create
10 2019-02-10 Bob b Create
 hidden batch(es)