I doesn't give an error, it just does not return any rows.
Here is the search I'm doing.
I have an 'Offender' table that has id, dob, ssn, first, last.
I have a 'Schedule' table that has (Offender.id)oid, case#, (and other information related to that case)
My search is a detailed search that allows a user to search by first, last, ssn or dob (any will work).
The search checks the schedule table to find if that offender has any cases in the schedule table.
But because the search criteria (first, last, dob, ssn) are in the offender table I use a subquery in the WHERE clause to find the offender.id to match against the schedule.oid.
SELECT offender.id, offender.f_name, offender.l_name, offender.m_initial, offender.dob, schedule.oid, schedule.case_no, schedule.pid FROM offender JOIN schedule ON offender.id = schedule.oid WHERE schedule.oid IN (SELECT offender.id FROM offender WHERE l_name LIKE '$l_name%' AND f_name LIKE '$f_name%' AND ssn LIKE '$ssn%' AND dob LIKE '$dob%')
Here is the search I'm doing.
I have an 'Offender' table that has id, dob, ssn, first, last.
I have a 'Schedule' table that has (Offender.id)oid, case#, (and other information related to that case)
My search is a detailed search that allows a user to search by first, last, ssn or dob (any will work).
The search checks the schedule table to find if that offender has any cases in the schedule table.
But because the search criteria (first, last, dob, ssn) are in the offender table I use a subquery in the WHERE clause to find the offender.id to match against the schedule.oid.
SELECT offender.id, offender.f_name, offender.l_name, offender.m_initial, offender.dob, schedule.oid, schedule.case_no, schedule.pid FROM offender JOIN schedule ON offender.id = schedule.oid WHERE schedule.oid IN (SELECT offender.id FROM offender WHERE l_name LIKE '$l_name%' AND f_name LIKE '$f_name%' AND ssn LIKE '$ssn%' AND dob LIKE '$dob%')