use join instead of sub-select