Changed the query give distinct values