Document do not exist or access restricted SELECT d.parent FROM docbelong as d, docinclude as i WHERE d.child=i.child AND i.parent NOT IN (2,3,34,35,39) AND d.child=77