Improving query for getting academic subjects