Q:

Postgres Warning: pg_query(): Query failed: ERROR: operator does not exist: boolean = integer LINE 1

i'm using postgres and i want tried date_diff, but i get this error 

Warning: pg_query(): Query failed: ERROR: operator does not exist:
  boolean = integer LINE 1

and then this is my query 
select id_mitra
      ,company_name 
from ref_mitra
where reject=0 and DATE_DIFF(now(),date_status) > 3 and active='N'

what wrong in my query?

A:

Cast your value 0 to boolean:
select id_mitra
      ,company_name 
from ref_mitra
where reject = CAST(0 as boolean) 
and DATE_DIFF(now(),date_status) > 3 
and active='N';

Or use a boolean:
select id_mitra
      ,company_name 
from ref_mitra
where reject = false 
and DATE_DIFF(now(),date_status) > 3 
and active='N';

DATE_DIFF() isn't a standard function in PostgreSQL, but maybe you created a function using this name.

