Skip to content

Instantly share code, notes, and snippets.

@StasKoval
Created July 22, 2016 13:17
Show Gist options
  • Save StasKoval/170d80ade0f9b19cb60ea43122e4d840 to your computer and use it in GitHub Desktop.
Save StasKoval/170d80ade0f9b19cb60ea43122e4d840 to your computer and use it in GitHub Desktop.
SELECT `Interview`.`id`, `Interview`.`title`, `Interview`.`description`, `Interview`.`complete_state`, `Interview`.`state`,
`Interview`.`access_token`, `Interview`.`salary`, `Interview`.`salary_comments`, `Interview`.`is_advanced`,
`Interview`.`is_private`, `Interview`.`stuck`, `Interview`.`createdAt`, `Interview`.`updatedAt`, `Interview`.`employer_id`,
`interviewResponses`.`id` AS `interviewResponses.id`, `interviewResponses`.`state` AS `interviewResponses.state`,
`interviewResponses`.`current_question` AS `interviewResponses.current_question`,
`interviewResponses`.`token` AS `interviewResponses.token`,
`interviewResponses`.`createdAt` AS `interviewResponses.createdAt`,
`interviewResponses`.`updatedAt` AS `interviewResponses.updatedAt`,
`interviewResponses`.`interview_id` AS `interviewResponses.interview_id`,
`interviewResponses`.`applicant_id` AS `interviewResponses.applicant_id`,
`applicants`.`id` AS `applicants.id`,
`applicants`.`first_name` AS `applicants.first_name`,
`applicants`.`last_name` AS `applicants.last_name`,
`applicants`.`email` AS `applicants.email`,
`applicants`.`type` AS `applicants.type`,
`applicants`.`password` AS `applicants.password`,
`applicants`.`token` AS `applicants.token`,
`applicants`.`createdAt` AS `applicants.createdAt`,
`applicants`.`updatedAt` AS `applicants.updatedAt`,
`applicants`.`company_id` AS `applicants.company_id`,
`applicants.interview_responses`.`createdAt` AS `applicants.interview_responses.createdAt`,
`applicants.interview_responses`.`updatedAt` AS `applicants.interview_responses.updatedAt`,
`applicants.interview_responses`.`applicant_id` AS `applicants.interview_responses.applicant_id`
FROM
`Interviews` AS `Interview`
LEFT OUTER JOIN
`InterviewResponses` AS `interviewResponses` ON `Interview`.`id` = `interviewResponses`.`interview_id`
LEFT OUTER JOIN
(`interview_responses` AS `applicants.interview_responses`
INNER JOIN `Users` AS `applicants` ON `applicants`.`id` = `applicants.interview_responses`.`applicant_id`)
ON `Interview`.`id` = `applicants.interview_responses`.`inteview_id`
WHERE
`Interview`.`access_token` = 'c8757c07-dcd6-41d3-bd47-b43719055b88'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment