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

Home -> Community -> Usenet -> c.d.o.server -> Differentiating results of SELECT query

Differentiating results of SELECT query

From: newbert <logangreen_at_gmail.com>
Date: 12 Dec 2006 23:55:57 -0800
Message-ID: <1165996557.441238.139980@j44g2000cwa.googlegroups.com>


I am working with two tables, "rides" and "locations" both shown below.  The 'start' and 'end' fields in table "rides" relate to the 'location_key' in table "locations."

I need to design a query where I can differentiate the start address from the end address. I am looking for a way to produce the same result that these two queries produce, but in a single query. If only Union functioned a little differently...

SELECT address AS start_address, ride_key FROM rides, locations
WHERE ride_key = '8'
AND START = location_key

SELECT address AS end_address, ride_key
FROM rides, locations
WHERE ride_key = '8'
AND END = location_key

Table: rides
+-------------+---------+-------+
| ride_key | start | end |

+-------------+---------+-------+
| 8 | 15 | 16 |

+-------------+---------+-------+

Table: locations

+-------------------+-----------------------------+

| location_key | address |
+-------------------+-----------------------------+
| 15 | 1234 Wilsher Blvd. |
| 16 | 999 Sunset Blvd |
+-------------------+-----------------------------+
Received on Wed Dec 13 2006 - 01:55:57 CST

Original text of this message

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