I'm beating my head against the wall trying to figure out why I can't add a new join to this query without breaking the app. The joined columns are of the same datatype and there's no violation of referential integrity. The line of code I added is in blue. The column names are spelled correctly. This code is at the start of the data model in Kolimarfy Places. I'm trying to add a dropdown for state name, which is the reason for this modification. The complete code is attached,
$this->sPlaceFields = "
`tpl`.`pl_id`,
`tpl`.`pl_thumb`,
`tpl`.`pl_name`,
`tpl`.`pl_directions`,
`tpl`.`pl_distance`,
`tpl`.`pl_gain`,
`tpl`.`pl_difficulty`,
`tpl`.`pl_solitude`,
`tpl`.`pl_paved`,
`tpl`.`pl_permit`,
`tpl`.`pl_wilderness`,
`tpl`.`pl_gps_lon`,
`tpl`.`pl_gps_lat`,
`tpl`.`pl_uri`,
`tpl`.`pl_desc`,
`tpl`.`pl_cat`,
`tpl`.`pl_country`,
`tpl`.`pl_state`,
`tpl`.`pl_city`,
`tpl`.`pl_zip`,
`tpl`.`pl_address`,
`tpl`.`pl_created`,
`tpl`.`pl_tags`,
`tpl`.`pl_status`,
`tpl`.`pl_map_lat`,
`tpl`.`pl_map_lng`,
`tpl`.`pl_map_zoom`,
`tpl`.`pl_map_type`,
`tpl`.`pl_author_id`,
`tpl`.`pl_featured`,
`tpl`.`pl_rss`,
DATE_FORMAT(`tpl`.`pl_created`, '" . $this->sDateFormat . "') AS `pl_created_f`,
`tplc`.`pl_cat_name`,
`tcn`.`Country` AS `pl_country_name`,
`tp`.`NickName`
";
$this->sPlaceJoin = "
INNER JOIN `" . K_TABLE_PREFIX . "places_cat` AS `tplc` ON (`tplc`.`pl_cat_id` = `tpl`.`pl_cat`)
INNER JOIN `sys_countries` AS `tcn` ON (`tcn`.`ISO2` = `tpl`.`pl_country`)
INNER JOIN `States` AS `tcs` ON (`tcs`.`StateCode` = `tpl`.`pl_state`)
LEFT JOIN `Profiles` AS `tp` ON (`tp`.`ID` = `tpl`.`pl_author_id` AND `tp`.`Status` = 'Active')
LEFT JOIN `" . K_TABLE_PREFIX . "photos` AS `tpli` ON (`tpli`.`pl_img_id` = `tpl`.`pl_thumb`)
";
}