In a MySQL query, one of the columns in the LEFT JOIN returns “Unknown column”
Question
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?
0
1 year
2021-12-02T17:54:11-05:00
2021-12-02T17:54:11-05:00 0 Answers
0 views
0
Leave an answer