In this sql I just want to check in "ON" clause b.block='False'.Because sometime "profileview " table values are empty. I just want ,If user_fullinfo values matches in profileview with this condition b.block='False' It should be display,If values are not there in profile view then also it should be display,
SELECT a.* FROM user_fullinfo a left join profileview b on
CASE
WHEN a.id=b.rid and b.rid='105' THEN
b.block='False'
END
where gender != 'Male' and (DATEDIFF(YY,dob,GETDATE()) Between '10' and '100') and (a.heightid between 58 and 65) and( a.complexionid = '3' or a.complexionid = '4' or a.complexionid = '5') and a.bodytypeid = '4' and a.marital_statusid = '3'
it says sql error (102) :incorrect syntax near "=".. Please give solution..