This might be more of a MySQL question, but since I’m in WordPress I thought I’d start here. Here’s my query:
$persons = $wpdb->get_results(
$wpdb->prepare(
'SELECT id, post_name, post_title
FROM wp_term_relationships AS tr, wp_posts AS ps
LEFT JOIN wp_terms AS wt ON tr.term_taxonomy_id = wt.term_id
...'
)
);
and here’s the error that is returned:
WordPress database error: [Unknown column 'tr.term_taxonomy_id' in 'on clause']
We know that term_taxonomy_id
is a column in the wp_term_relationships
table so I’m not sure why the column is unknown
unless there is something about the order of things.
Thoughts?