Distinct records on Select statement ORACLE-SQL -


i have table possible duplicate records except 1 field i.e field2 in below table. field1 key join table.

field1  field2  field3   aa      t       qqq   aa      f       qqq   bb      f       eee   cc      t       rrr 

now in field2, if t , f both there same field1, want select row t field 2 values. in case t or f available want record. output of select statement should be

field1  field2  field3   aa      t      qqq   bb      f      eee   cc      t      rrr 

help me if there efficient way it.

for requirement use:

select     field1,      max(field2) field2,    max(field3) keep(dense_rank first order field2 desc) field3     table group     field1; 

the third column function gets corresponding row field2.


Comments