Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> IF in a SELECT--can you do this?

IF in a SELECT--can you do this?

From: Tamara Swilley <tswilley_at_agency.com>
Date: Fri, 17 Nov 2000 10:40:31 -0700
Message-Id: <10683.122390@fatcity.com>


Hi listers; happy Friday!!

I have a question.... can you put an IF on a SELECT statement? I have a query joining 7-8 tables and I'm getting back (technically) unique rows (four columns returned) that look something like:

red	blue	yellow	A
red	blue	yellow	P

The user says the fourth column values (for every pair of rows) can be "P and A" or "A and A". In the first case they want to see only the "P" row and in the second case, either row (since both would be "A"). How would I (1) join this table to itself with a WHERE clause to get the desired result, or (2) put a conditional IF in the SELECT so that I only get one row: a P in the case of two diff values or A in the case of two As (if this is possible)? In essence, I want to cut my results in half and only show one of two rows.

Oracle 8.0.5 on Solaris 2.6 (if it matters in this case).

Thanks in advance,

Tamara Swilley
Oracle DBA
AGENCY.COM: Vail
970-845-2173 Received on Fri Nov 17 2000 - 11:40:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US