hi friends,

I have creted table TBL with structure as below.

SQL> desc tbl
Name Null? Type
----------------------------------------- -------- ----------------------------
COL1 VARCHAR2(5)
COL2 VARCHAR2(5)
KEY VARCHAR2(5)

Sample data is:


COL1 COL2 KEY
----- ----- -----
y val2 ST
x val1 ST

I need query to return output.

select col1,col2 from tbl where key='ST';

If col1 has only x , print corresponding row. If col1 has only y , print corresponding row. If col1 has two values both x and y, print first row only.

Thanks,
Bhaskara