Jump to content

INNER JOIN problem with SQL query


tvdhoff

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.