Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Out of joint again
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00134203
Message ID:
00134246
Views:
11
>>>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.
>
>Locations is where the "word version" of the keys ipickup and idropoff come from. That's the one that's giving me the most trouble right now.
>
>Thanks,
>
>-Michelle

lockey is ipickup and idropoff?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform