I'm doing a simple join query of job_roles and operations table.
The fk is the column job_role_id of operations references to the column id of job_roles.
Output that I need is get the total count of data from operations where operations.structure_cost is not equal to job_roles.cost_type
I have a working query created in MySQL Workbench using this code below:
SELECT COUNT(*) as total
FROM
job_roles t1
RIGHT JOIN
operations t2 ON t2.job_role_id = t1.id
WHERE
t2.structure_cost != t1.cost_type
t2.master_id = 1; ### get operations only for auth user
Below is my query in Laravel that don't work. Count that I'm getting in below data example is 3 which is wrong, Count should return 1 as what is indicated in the where clause
table name: job_roles
table name: operations


