SQLTeam.com | Weblogs | Forums

SQL Query If is Null


#1

The image show where I need help:


#2
Select P.PostID, P.PostData, AC.UserName, AC.UserID, IM.ImageURL, CASE When PR.PostID is null then 0 Else 1 END
FROM Posts P, Users AC, Images IM
Left Outer Join PostRead PR
ON P.PostID = PR.PostID
AND AC.Code IN ('+ @in_friends +')
WHERE  AC.UserID = P.UserID AND P.ImageID = IM.ImageID
(AC.Code IN ('+ @in_friends +')  OR AC.Code IN (' + @in_mycode + '))