Hello,
I have the following sql query which works:
$query="SELECT * FROM submissions
WHERE ((submission_employer_country = '$search_country') AND (submission_employer_department = '$search_department'))
order by submission_timestamp
desc limit 10";
one of the variables returned is the user's account number. I then want to find the corresponding username for each account number, by querying the "accounts" tables as follows (I've replaced "*" from the code above with all the field names in the "submissions" table):
$query="SELECT submissions.submission_number, submissions.submission_employer_company, submissions.submission_employer_industry,
submissions.submission_employer_town_or_postcode, submissions.submission_employer_country, submissions.submission_employer_department,
submissions.submission_employer_department_hiring_situation_detailed, submissions.submission_employer_department_hiring_situation_summary,
submissions.submission_employer_application_contact, submissions.submission_employer_latitude,
submissions.submission_employer_longitude, submissions.submission_account_number, submissions.submission_timestamp,
accounts.account_number
FROM submissions
WHERE ((submission_employer_country = '$search_country') AND (submission_employer_department = '$search_department'))
INNER JOIN accounts
ON submissions.submission_account_number=accounts.account_number
ORDER BY
submission_timestamp desc limit 10";
but the above code is failing. please could point me in the right direction?