I would like to write one select statement in postgres how could I place if condition in where condition
To creating a report in that suppose we have 20 country in our table and and we have three type of employee which having contact, payroll and permanent these are the employee_category I would like to get all employee details except India and USA who having contact employee in these two country if employee having payroll and permanent should come in result
something like this
SELECT
r.employee_id AS E_ID,
r.Joining_date AS J_DATE,
r.employee_type AS E_TYPE,
'NIL'::text AS REMARKS,
i.source as SOURCE,
i.user_orgname as USER_ORGNAME
from master_employee r
INNER JOIN users_master AS i ON r.user_id = i.loginid and i.userstatus = 'Active'
WHERE
if(country="india","USA"){
employee_category!='contract'
}
and
date(r.createddate) = date(now())
ORDER BY r.createddate ASC ;
where not (country in ('india', 'USA') and employee_category = 'contract') and ...IndiaandUSAwho having contact employee in these two country if employee having payroll and permanent should come in result @George query is working but the 215 record is missing