BAD SQL: SELECT Docs.* FROM Docs, SiteAreas WHERE SiteAreas.Title='' AND Docs.Section = SiteAreas.ID AND SiteAreas.Tree like '_00000_00543%' ORDER BY RAND() LIMIT 0,1