Sql Query Select Distinct With Row Number