Query a table based on field values from another table

bsha100

New Member
Messages
3
Reaction score
0
Points
0
Hey everyone,

I have a little problem with a mysql query. I need to query a database table for 'places' to retrieve the name, and picture associated with the picture. I want to be able to include the location, however location information is contained in a separate database. The location is linked to it's corresponding place by a common field 'location_id'. Does anyone know how to query the location and return the results from the places as well, or vice versa?

Thanks
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Assuming you meant to ask "how do I query multiple tables in a single query?", the answer is "use joins" (see also "A Visual Explanation of SQL Joins"). If you need more specific help, please post sample code (which in this case would be the table schema (CREATE TABLE) statements and sample data as INSERT statements) along with the desired result for the sample data.
 
Last edited:
Top