Check this one
Select Device_Person_id,personal_id,Date1,(
cASE WHEN eXISTS(
sELECT Device_Person_id
FROM tempDeviceLogs AT WHERE T.personal_id=AT.Device_Person_id AND T.date1=AT.logDateTime
) then 'P' Else 'A' End )as Status
FROM
(
Select b.Device_Person_id,a.personal_id,Cast(b.logDateTime as DATEtime)AS DATE1 from Emp_setting a,tempDeviceLogs b
) T
find below improved version.
Here I am assuming columns in join are having same values.
Select Device_Person_id,personal_id,Date1,(
cASE WHEN eXISTS(
sELECT Device_Person_id
FROM tempDeviceLogs AT WHERE T.personal_id=AT.Device_Person_id AND T.date1=AT.logDateTime
) then 'P' Else 'A' End )as Status
FROM
(
Select b.Device_Person_id,a.personal_id,Cast(b.logDateTime as DATEtime)AS DATE1 from Emp_setting a left outer join tempDeviceLogs b on b.Device_Person_id = a.personal_id
) T
Hope this will help you more.