Question : LIKE operator in SQL not working

I am trying to obtain data from our tables based on multile LIKE statements.  The query works until I try to add this part to the syntax
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
SELECT DISTINCT avr.role_cd, avr.role_nm, td.person_id, tj.job_nm,
    tc.first_nm + ' ' + tc.last_nm AS 'Full Name', td.job_id, tj.job_mne_cd
FROM ais_db.dbo.v_role avr 
    JOIN bill_db.dbo.t_person_legal_entity_role tpler 
        ON avr.role_cd = tpler.role_cd
    JOIN bill_db.dbo.t_contact tc ON tpler.person_id = tc.contact_id
    JOIN crs_db.dbo.t_distr td ON tpler.person_id = td.person_id
    JOIN crs_db.dbo.t_job tj ON tj.job_id = td.job_id
WHERE tc.active_flg = 'Y' AND tj.job_mne_cd NOT LIKE 'Z%' AND
    (avr.role_cd LIKE '%Main Contact%' 
        OR LIKE '%Named Fiduciary%'
        OR LIKE '%Day%' OR NOT LIKE '%Client Reporting%' 
        OR LIKE '%Proxy Contact%'
        OR  LIKE '%Revenue%'
        OR LIKE '%Paper%')

Answer : LIKE operator in SQL not working

You have forgotten to add avr.role_cd before each Like

SQL is not so intelligent yet !
Random Solutions  
 
programming4us programming4us