Added distinct select support.