我想使用內部連接查詢來合併4個表。我寫過這樣的查詢。通過內部連接查詢的順序與where子句
select t.name,t.slug,tt.term_taxonomy_id,tt.description,tr.object_id,p.post_content,p.post_title,pm.meta_value from wp_terms as t join wp_term_taxonomy as tt on tt.term_id = t.term_id join wp_term_relationships as tr on tr.term_taxonomy_id = tt.term_taxonomy_id join wp_posts as p on p.ID = tr.object_id join wp_postmeta as pm on pm.post_id = p.ID AND pm.meta_key = 'zgir_df252314' order by pm.meta_value where t.term_id = 101
但是它會顯示這樣的
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where t.term_id = 101
LIMIT 0了Syntex錯誤,25' 在行1
請幫我解決這個錯誤。
通過訂單之前將您的where語句,嘗試直接使用的東西,像phpMyAdmin或MysqlWorkbench – Scriptable 2015-04-04 10:04:25