Skip to content

Instantly share code, notes, and snippets.

@kenjox
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save kenjox/6ef877ec48174c5da89f to your computer and use it in GitHub Desktop.

Select an option

Save kenjox/6ef877ec48174c5da89f to your computer and use it in GitHub Desktop.
interviewee table
+----+---------------------+----+-------+
| id | dateTime | value |
+----+---------------------+----+-------+
| 1 | 2015-30-21 12:30:20 | 30 |
| 2 | 2015-30-21 12:30:21 | 30 |
| 3 | 2015-30-21 12:30:22 | 50 |
| 4 | 2015-30-21 12:30:23 | 50 |
| 5 | 2015-30-21 12:30:24 | 50 |
| 6 | 2015-30-21 12:30:26 | 50 |
| 7 | 2015-30-21 12:30:27 | 30 |
| 8 | 2015-30-21 12:30:51 | 50 |
+----+---------------------+----+-------+
interviewer table
+----+---------------------+----+-------+
| id | dateTime | value |
+----+---------------------+----+-------+
| 1 | 2015-30-21 12:30:26 | 30 |
| 2 | 2015-30-21 12:30:27 | 30 |
| 3 | 2015-30-21 12:30:28 | 50 |
| 4 | 2015-30-21 12:30:29 | 50 |
| 5 | 2015-30-21 12:30:30 | 50 |
| 6 | 2015-30-21 12:30:40 | 50 |
| 7 | 2015-30-21 12:30:50 | 30 |
| 8 | 2015-30-21 12:30:51 | 50 |
+----+---------------------+----+-------+
video table
+----+-----------+---------------------+---------------------+
| id | name | start_time | end_time |
+----+-----------+---------------------+---------------------+
| 1 | interview | 2015-30-21 12:30:27 | 2015-30-21 12:30:51 |
+----+-----------+---------------------+---------------------+
Expected results
interviewee table
+----+---------------------+----+-------+
| id | dateTime | value |
+----+---------------------+----+-------+
| 7 | 2015-30-21 12:30:27 | 30 |
| 8 | 2015-30-21 12:30:51 | 50 |
+----+---------------------+----+-------+
interviewer table
+----+---------------------+----+-------+
| id | dateTime | value |
+----+---------------------+----+-------+
| 2 | 2015-30-21 12:30:27 | 30 |
| 3 | 2015-30-21 12:30:28 | 50 |
| 4 | 2015-30-21 12:30:29 | 50 |
| 5 | 2015-30-21 12:30:30 | 50 |
| 6 | 2015-30-21 12:30:40 | 50 |
| 7 | 2015-30-21 12:30:50 | 30 |
| 8 | 2015-30-21 12:30:51 | 50 |
+----+---------------------+----+-------+
@kenjox
Copy link
Author

kenjox commented May 28, 2015

So the goal is to fetch the data for each participant. The query should make sure it starts fetching data where the starting time is equal for all the tables and and the end time is also equal. So in the end there will be results returned in between the start_time and end_time from each table. The video end time is the one determining end time for both interviewee table and interviewer table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment