Jump to content

find unjoined records


michaellunsford

Recommended Posts

There are two tables. One table has the generic description and such, the other has a record number from the previous table, and a date relating to that record. Now, there are some records in the first table that do not have any matching records in the second -- and those are the ones I want to isolate: how do I do that?

 

For example:

1st table:
event:
  keyfield => 1
  name => Event Name1
  description => Some descriptive text, usually in html
event:
  keyfield => 2
  name => Event Name2
  description => Some descriptive text
event:
  keyfield => 3
  name => Event Name3
  description => Some descriptive text

2nd table:
event_date:
  keyfield => 0
  event => 1 (keyfield from `event` table)
  date => 2011-10-24
event_date:
  keyfield => 1
  event => 3 (keyfield from `event` table)
  date => 2011-10-24

 

I want to know that the event with the keyfield of '2' does not have a record in the `event_table` I can get it done one record at a time with a php loop -- but I'm thinking MySQL probably has a single routine that can accomplish this. Any idea?

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.