Created
February 21, 2019 09:42
-
-
Save farhaven/3df4092485a62a6ddb5a2a24a0e575d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE events (id INTEGER PRIMARY KEY, timestamp INTEGER, machine STRING); | |
INSERT INTO events (timestamp, machine) VALUES (123, 'a'); | |
INSERT INTO events (timestamp, machine) VALUES (234, 'a'); | |
INSERT INTO events (timestamp, machine) VALUES (345, 'a'); | |
INSERT INTO events (timestamp, machine) VALUES (456, 'a'); | |
INSERT INTO events (timestamp, machine) VALUES (555, 'b'); | |
INSERT INTO events (timestamp, machine) VALUES (444, 'b'); | |
INSERT INTO events (timestamp, machine) VALUES (333, 'b'); | |
INSERT INTO events (timestamp, machine) VALUES (222, 'b'); | |
INSERT INTO events (timestamp, machine) VALUES (111, 'b'); | |
INSERT INTO events (timestamp, machine) VALUES (900, 'c'); | |
SELECT * FROM (SELECT * FROM events ORDER BY timestamp) GROUP BY machine; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment