I have two tables that I need to pull data from. The first table is applications and the second is verification_status. Each application has 20 steps and the verification_status contains a date of when that step was completed. I am trying to pull the application along with the completion dates from a number of specific steps.
Essentially what I want is a row that has all the applications data, along with the dates from the specific verification status rows matched based on applications_id and verification_step_id.
I tried this and I am getting an error that says "Unknown column 'applications.id' in 'where clause'"
It works fine when I take out the subquery.
SELECT * FROM applications,
(SELECT date FROM verification_status WHERE application_id = applications.id AND verification_step_id = 1) as steponedate
LEFT JOIN application_details ON application_details.application_id = applications.id
WHERE application_details.application_status_id != 1 AND application_details.application_status_id != 2