Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Multi-query simplification
I am querying records containing information about credit card transactions, and I only want to find *one* record with this query and no more. Criteria A is the customer's credit card number and criteria B is a reference number given to the transaction which is not necessarily unique. Criteria C is the date of the transaction and criteria D is the dollar amount of the transaction.
The first level query would look like this:
SELECT data FROM table WHERE A AND B AND C AND D;
If nothing is found with this query, I must then do:
SELECT data FROM table WHERE A AND B AND C;
If nothing is found with this query, I must then do:
SELECT data FROM table WHERE A AND B AND D;
Finally, if nothing is found with this query, I must then do:
SELECT data FROM table WHERE A AND B;
In general, the query that ultimately is successful will find only one record. I only *want* one record, which is why I don't just start with the last query. I was wondering if there was some way to simplify this process. Remember, I'm looking for precisely one record.
Thanks,
Michael Bongiovi
NeuralTech, Inc.
Fairfax, VA
Received on Mon Dec 29 1997 - 00:00:00 CST