I am confused over the relationship of the wp_posts and wp_postmeta tables.
I would like to select all the posts from wp_posts, which do not have a custom field ( which I have created ) in the wp_postmeta table. I had been assuming that 'ID' in wp_posts is the primary key and that 'post_id' in wp_postmeta corresponds to it, but I'm no longer sure that this is the case.
If this is not the case , then how does one link the 2 tables?
I have been experimenting with the following query:
$postIDs = $wpdb->get_col("SELECT ID FROM $wpdb->posts INNER JOIN $wpdb->postmeta ON ID=post_id WHERE meta_key<>'keyword'");
this returns the correct post_ids from the wp_postmeta table.
However I am looking for The IDs from the wp_posts table.
Any ideas on how to write a query to get the latter?
Thanks in advance,