The problem occurs with wo.status = 'in_progress' OR 'ongoing' part executes. If 'in_progress' returns true but 'ongoing' returns false the overall result with be false (i.e. wo.status is neither in_progress or ongoing). The result I'm looking for would be that if either 'in_progress' or 'ongoing' are true then the overall result would be true.
I'm querying a database as follows:
SELECT wo.*, c.address
FROM WorkOrder AS wo
LEFT JOIN Customer AS c
ON c.id = wo.customer_id
LEFT JOIN AssignedTechs AS at
ON at.work_order_id = wo.id
WHERE at.technician_id = ?
&& wo.status = 'in_progress'
OR 'ongoing' AND at.active";