I got this query that works perfectly:
SELECT FOLDER.folderid, FOLDER.foldername
FROM FOLDER
INNER JOIN COLLABORATORS ON COLLABORATORS.folderid = FOLDER.folderid
WHERE COLLABORATORS.userid = 23
But when I added this on the where clause: "and FOLDER.parent = NULL" it doesnt work. The complete query is:
SELECT FOLDER.folderid, FOLDER.foldername
FROM FOLDER
INNER JOIN COLLABORATORS ON COLLABORATORS.folderid = FOLDER.folderid
WHERE COLLABORATORS.userid = 23 and FOLDER.parent = NULL
Does anyone know whats going on? Thanks
when dealing with
NULL
, you cannot use =
or <>
since the values are unknown but instead use IS NULL
or IS NOT NULL
,WHERE COLLABORATORS.userid = 23 and FOLDER.parent IS NULL
- MySQL - Working with NULL Values
0 comments:
Post a Comment