query in oracle
-
hi, i have formed query using several joins. Now that i want the data to be unique, so thuoght of using 'distinct' but it does not seem to help. There is a column named Id in the query and i dont want this to be duplicated hence i gave select distinct(id), ....... but this showed up some error. when using distict it is applying for the entire row, so its checking for each and evry column. Is it possible to use distinct keyword for one or two coulmns instead for the entire row i.e. all columns
gauthee
-
hi, i have formed query using several joins. Now that i want the data to be unique, so thuoght of using 'distinct' but it does not seem to help. There is a column named Id in the query and i dont want this to be duplicated hence i gave select distinct(id), ....... but this showed up some error. when using distict it is applying for the entire row, so its checking for each and evry column. Is it possible to use distinct keyword for one or two coulmns instead for the entire row i.e. all columns
gauthee
gauthee wrote:
Is it possible to use distinct keyword for one or two coulmns instead for the entire row i.e. all columns
No. Adding the
DISTINCT
keyword specifies that only unique rows can appear in the resultset. You should add aGROUP BY
clause to your query and group on the fields where you do not want duplicate values in the resultset.Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush