illion
asked on
Join two table fields to one field
I have two tables "Locations" and "Hotel". i wanna join:
Locations.Locations and Hotel.Hotel
in one field. so you can select from a list with both the values from locations and hotel. Im using Microsoft Access by the way. i have tried with SELECT Locations.ID, Locations.Locations, Hotel.ID, Hotel.Hotel FROM Locations, Hotel;
but that doesnt seem too work i get alot of the same values. Im only working in Access so i only have the option of creating one single SQL query. i have tried with union aswell but it doesnt work either...
Locations.Locations and Hotel.Hotel
in one field. so you can select from a list with both the values from locations and hotel. Im using Microsoft Access by the way. i have tried with SELECT Locations.ID, Locations.Locations, Hotel.ID, Hotel.Hotel FROM Locations, Hotel;
but that doesnt seem too work i get alot of the same values. Im only working in Access so i only have the option of creating one single SQL query. i have tried with union aswell but it doesnt work either...
ASKER
hmm ok, but the Locations.Locations and Hotel.Hotel wont be the same value, thats why i want to add both to one field, cause locations wont contain the names of the hotels, so instead of writing the hotel names in locations.locations im trying to just join them.
ASKER
I have another table Transfers and in that table i have a field called From and it can both be from a Location or a Hotel, so i want to be able to choose from both the values in Locations.Locations and Hotel.Hotel.
Post some sample data and the desired output.
ASKER
Table1 : Locations
-------------------------- ---------- ---------- ---------- -
ID | Locations
1 Beach Bar
Table2 : Hotel
-------------------------- ---------- ---------- ---------- -
ID | Hotel | Address | City | Zip
1 Turtle beach blabla 23 bla 123
Table3: Transfer
-------------------------- ---------- ---------- ---------- -
ID | From | To
1 "Here i want a list with both the values from Hotel.Hotel and Locations.Locations"
--------------------------
ID | Locations
1 Beach Bar
Table2 : Hotel
--------------------------
ID | Hotel | Address | City | Zip
1 Turtle beach blabla 23 bla 123
Table3: Transfer
--------------------------
ID | From | To
1 "Here i want a list with both the values from Hotel.Hotel and Locations.Locations"
ASKER
if i write SELECT Hotel.ID, Hotel.Hotel FROM Hotel
i only get the hotels not the other locations and if i do the other way around i only get the other locations
i only get the hotels not the other locations and if i do the other way around i only get the other locations
So what is the relationship (which column) between the Locations and Hotel tables.
The same goes for your Transfer table.
Finally, what is your desired output. Please give an example.
Finally, what is your desired output. Please give an example.
ASKER
there is no relationship between them its just that i have other Locations in a separate table and Hotels in the Hotel table, and i want to be able to choose from both when i choose transfers.
If there is no relationship between the three tables, than I have no idea.
ASKER
I dont want any output, im only working inside a database so if theres gonna be any output it should be that Transfer.From should be able to contain both the value from Locations.Locations and Hotel.Hotel. I guess i want a relation between:
Transfer.From -> Locations.Locations & Hotel.Hotel
Transfer.From -> Locations.Locations & Hotel.Hotel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help, thanks for the points
D
D
Locations.Locations,
Hotel.ID,
Hotel.Hotel
FROM Locations
Inner Join Hotel On Locations.Locations = Hotel.Hotel