I need to select distinct rows like the below example
Source table values
Column 1 | Column 2
A  A10
A  A11
A  A12
B  B12
c  C11
D  D10
D  D78
Expected output after select query:
Column 1 | Column 2
A  A10
B  B12
C  C11
D  D10
So if there are duplicates in column 1 I need to get distinct rows by selecting records in col2 that ends with 10.....if col1 is unique go ahead with the col2 value.....it need not be ending with 10
Update: cannot apply distinct on as there are other columns as well with different values for each row and cannot use temp table as I need to accommodate it in a where clause of single select query
 
     
     
    