My query looks like:
SELECT *
FROM users U
LEFT JOIN posts P ON P.userId = U.id AND P.userId IS NOT NULL;
Why the query also return result where userId
is null
?
I know that for my needs I can use INNER JOIN
to get only posts related to user but is so strange that LEFT JOIN
support multiple conditions, but not work with NOT NULL conditions.