
January 24th, 2013, 09:54 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 2
Time spent in forums: 1 h 5 m 8 sec
Reputation Power: 0
|
|
|
Finding items from one table that don't exist in another table
Hi,
OK, I hope I will explain this clearly,
I have three tables:
1. wp_posts
2. wp_postmeta
3. companies
wp_posts stores information about the post.
wp_postmeta stores information like custom fields of the post.
companies is a table that gets updated daily with current companies, so if a company is no more our client then they will get deleted from the companies table.
Now, wp_posts and wp_postmeta share post_id and wp_postmeta and companies share company_id, however, wp_postmeta stores company_id as a char while companies stores company_id as an int.
I would like to find all the company_id that exist in wp_postmeta but don't exist in companies and then change their post_status in wp_posts from publish to draft.
I hope that's clear,
Thanks!
|