>Everytime I think I've got joins figured out, they turn out not to work the way I thought. This time they've really got me confused.
>
>I have the following tables, with the relevant fields:
>
>To_ver: tripkey
>Clients: clientkey, clname
>Trips: clientkey, tripkey, ipickup, idropoff
>Locations: lockey, cloc
>
>I want all the records from to_ver (which is a list of trips that were taken). All the records in to_ver have trips associated with them. From these trips, I want to connect to the clients table to get "clname", and connect to the locations table to get the "cloc" associated with ipickup and idropoff. (ipickup and idropoff contain the equivilent of lockey in the locations table)
>
>I need to end up with all the info from to_ver, matched with the client that took the trip, and the pickup and dropoff location.
>
>So how do I do that in SQL?
>
>Thanks,
>
>-Michelle
select to_ver.*, clname, ipickup, idropoff from to_ver ;
left outer join trips on to_ver.tripkey = trips.tripkey ;
join clients on trips.clientkey = clients.clientkey
left locations out because i don't see how it is related to any of the other three tables.