Edit : Looking at it now, when I examine the query, it seems like its doing "SELECT ways" when really what I want is "FROM ways SELECT main_id WHERE main_id=wDict