Skip to content

Instantly share code, notes, and snippets.

@MarkyC
Created November 27, 2018 22:37
Show Gist options
  • Select an option

  • Save MarkyC/7fee1af06dfca01b0da1fccbeab55934 to your computer and use it in GitHub Desktop.

Select an option

Save MarkyC/7fee1af06dfca01b0da1fccbeab55934 to your computer and use it in GitHub Desktop.
-- http://sqlfiddle.com/#!17/9ba87/5
CREATE TABLE order_event(
id int,
order_id text,
event_name text,
created timestamp default CURRENT_TIMESTAMP
);
INSERT INTO order_event(id, order_id, event_name) VALUES
(1, 123, 'event A'),
(2, 123, 'event B'),
(3, 123, 'event C'),
(5, 456, 'event A'),
(6, 789, 'event A'),
(7, 789, 'event B'),
(8, 321, 'event A'),
(9, 321, 'event B'),
(11, 321, 'event C'),
(12, 321, 'event D')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment