General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>>I have a clients table and a locations table. Each client has and address that is in the locations table. I want to join the clients table to the locations table so I can replace the address in the clients table with the key to that address in the locations table.
>>
>>For the most part, there is only one of each address in the locations table. But because I'm working with bad data, there might be more than one.
>>
>>Is there a join that will take one and only one of each client and match it up to the first address in locations that it finds, and doesn't make a second entry of the same client for the second address in locations?
>>
>
>If you don't mind doing a two stage query.
>
>SELECT * FROM locations GROUP BY id INTO CURSOR locations2
>SELECT clients.*, locations2.address FROM clients, locations WHERE clients.id = locations2.id INTO CURSOR clientloc
>
>ID is the unique key between the two tables.
Sorry. There was a typo. I took out the duplicate "group by id"
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only