Improve the query by using a JOIN

data should not be filtered in the SELECT clause, so use a more efficient join.