I'm having a problem with a MYSQL Join accross three tables. I'm new to MYSQL Join functions, and can't quite figure out how to write the code. My current code is horribly innefficient and does not implement explicit joins, which I believe is much of the problem. Here it is(in php):

mysql_query("Select Airports.*, Regions.name AS RegionName, Countries.name AS CountryName, Regions.local_code AS StateCode FROM Airports, Regions, Countries WHERE Airports.ident LIKE '%".$fix."%' AND Regions.iso_region=Airports.iso_region AND Countries.code=Airports.iso_country")

I think this code shows pretty clearly which information I need from the database. Any suggestions on how to write the explicit join would be much appreciated!

Yeah, you have to actually tell it what tables to join and where. It would be hard for me to tell how to write this since I don't know what needs to be joined but I would check out the following link and see the section about INNER JOIN. http://www.sitepoint.com/understanding-sql-joins-mysql-database/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.