我想將Wordpress數據轉換成我自己的數據庫,他們的數據庫結構給我的問題。這很難解釋,所以忍受着我。加入兩個表,其中一個有多行
我有兩個表如下。他們加入了wp_post.ID = wp_postmeta.post_id
。
wp_posts
+----+------------+--------------+
| ID | post_title | post_content |
+----+------------+--------------+
| 1 | Game Title | some content |
+----+------------+--------------+
wp_postmeta
+---------+--------------+------------+
| post_id | meta_key | meta_value |
+---------+--------------+------------+
| 1 | post_type | Review |
+---------+--------------+------------+
| 1 | game_rating | 8.0 |
+---------+--------------+------------+
| 1 | game_genre | FPS |
+---------+--------------+------------+
現在我必須爲每一個meta_value進入我希望(WHERE meta_value = 'Review'
),例如做一個查詢。
有沒有辦法讓我運行一個查詢並返回post_title,post_content,post_type,gaming_rating和game_genre?