tvdhoff Posted August 7, 2006 Share Posted August 7, 2006 Hi all,This calendar page uses two database tables: 'calendar' which holds the appointment info and which is linked using column 'location_id' with table 'locations' which holds the location details.On the overview page I retrieve appointments using this query which works fine:[code]$listAppointmentsQuery="SELECT id,name,DATE_FORMAT(date,'%d-%m-%Y') AS date,time,location_name FROM calendar INNER JOIN locations USING (location_id) ORDER BY date DESC";[/code]However, when a user deletes a location, the appointments that have that location are not displayed using this query. Is there a way to modify the query so that those entries are displayed (with an empty location) as well?I'd rather not have to run through all appointments resetting their location_id when a location is deleted....thanks!Tim Link to comment https://forums.phpfreaks.com/topic/16787-inner-join-problem-with-sql-query/ Share on other sites More sharing options...
king arthur Posted August 7, 2006 Share Posted August 7, 2006 Try a left join. Link to comment https://forums.phpfreaks.com/topic/16787-inner-join-problem-with-sql-query/#findComment-70610 Share on other sites More sharing options...
tvdhoff Posted August 7, 2006 Author Share Posted August 7, 2006 thanks, that helped. Link to comment https://forums.phpfreaks.com/topic/16787-inner-join-problem-with-sql-query/#findComment-70614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.