Below is my query where i want to check whether record from TABLE A is being used in TABLE B and based on that i am returning 'Y' and 'N'. 

```
SELECT DISTINCT 
    ca.ID,
    IF(da.AM_SYSID IS NULL, 'Y', 'N')
FROM 
    TABLEA ca
LEFT JOIN 
    TABLEB da ON ca.ID = da.AM_SYSID

```

but I am getting an error 

> 
> The multi-part identifier could not be bound. searched for solution 
> 
> 
> 

I'm still unable to see my mistake.