skallsen Posted April 24, 2006 Share Posted April 24, 2006 Hi all! I'm developing my new site and having trouble with getting an inner join to work with PHP/MySql.I have an inner join that DOES work and looks like this:$query = "SELECT antique_stores.StoreName, antique_stores.StoreAddress1, antique_stores.StoreCity, antique_stores.StoreZip, antique_stores.StoreTelephoneFROM antique_stores INNER JOIN Cities ON antique_stores.StoreCity = Cities.CityNameWHERE Cities.CityID = ".$city;I want to do something similar but have more requirements:$query = "SELECT * FROM SaleListing INNER JOIN Cities SaleListing.SaleCity = Cities.CityNameWHERE SaleCity = ".$SaleCity." AND Day1Date= '".$searchdate."' AND Cities.CityID = ".$SaleCity;I've tested for both variables $SaleCity and $searchdate and they are being successfuly passed. $SaleCity is a number for the city from the Cities db.This query is working great but I really need to substitute the CityName for the SaleCity/CityID number so that it shows the name instead: $query = "SELECT * FROM SaleListing WHERE SaleCity = ".$SaleCity." AND Day1Date= '".$searchdate."'"; Any ideas? Thanks! Link to comment https://forums.phpfreaks.com/topic/8228-questions-about-doing-an-inner-join/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.