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

Home -> Community -> Usenet -> c.d.o.tools -> Question for an SQL expert

Question for an SQL expert

From: <miltjef_at_co-opsonline.com>
Date: 2000/05/25
Message-ID: <8gjf1s$b5p$1@nnrp1.deja.com>#1/1

Could some SQL expert answer the following question?

I have a table that contains the following columns:

PRDGRP_ID
ZONE_ID
SRP Sample data:

1,1,1.99
1,2,1.89
1,3,1.79
2,1,2.99
3,1,6.99
3,3,7.05

I am trying to write a SQL query that will return the SRP for a givin zone_id. Example if I request zone_id "1", I want the following to be returned:

1,1,1.99
2,1,2.99
3,1,6.99

That was easy, now the hard part. If I request a zone_id and it doesn't exists for a prdgrp_id, I want the default zone_id record to be returned (in this example the default zone_id is 1). So if I request zone_id "2", I want the following:
1,2,1.89
2,1,2.99 (since there isn't a zone_id of "2", return the default)
3,1,6.99 (since there isn't a zone_id of "2", return the default)

Could someone help me with this query?

Thanks,
Jeff Milton

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu May 25 2000 - 00:00:00 CDT

Original text of this message

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