I’m trying to read candidates and the relation with expertises from 2 custom tables in my WP Database.
This is my WPDB query :
$candidates = $wpdb->get_results("
SELECT *
FROM wp_bullhorn_candidates
INNER JOIN wp_bullhorn_candidates_expertise
ON wp_bullhorn_candidates.id = wp_bullhorn_candidates_expertise.candidate_id
WHERE wp_bullhorn_candidates.inserted = 0
OR wp_bullhorn_candidates.changed = 1
GROUP BY wp_bullhorn_candidates.id;
");
This is an example of an object in my array:
[3] => stdClass Object
(
[id] => 7
[firstname] => azaeezeza
[lastname] => bbb
[email] => azerty@qwerty.com
[current_job_title] => zezaezaeaz
[jobtype] => Open for both
[location] => West-Vlaanderen
[experience] => 3-5
[receive_vacancies] =>
[inserted] => 0
[changed] => 0
[bullhorn_id] => 1123222
[candidate_id] => 4
)
As you can see is the id not equel to the candidate_id … . Wen I run this query in my SQL Editor on the same DB (Sequel Pro in my case) I get perfect results … .
An example of result in Sequel Pro:
How is it possible the same query is giving different results?
I also tried to print the errors but my array was empty so no errors.