With the query dump, I was able to figure it out!
I used this to output the query on the back end:
Code: Select all
JFactory::getApplication()->enqueueMessage('Query dump: ' . print_r($query->dump(), true));
The output showed that the issue was with quotes around the strings in the array. I changed it to what is below and now it works as it should.
Code: Select all
->where($db->quoteName('b.primary_department_id') . " IN ('" . (implode("','", $primary_department_ids)) . "')" );
This is the dump of the related part of the query (after fixing it):
Code: Select all
WHERE `b`.`primary_department_id` IN ('10336','10367','10371')
I suspected the quotes were the problem, but without the dump, I wasn't able to see exactly what was happening
Thank you!!