對不起我的英語!!!!如何在SQL查詢中從另一個表中檢索元素?
我從表中獲取數據wp_posts,現在我需要從表獲取數據wp_postmeta匹配,在wp_posts表中捕獲的ID。
,我需要在表中wp_postmeta搶的數據是product_img1
,product_img2
,product_img3
如圖圖像的下方。
這是我wp_posts的觀點:
我需要顯示ID,POST_TITLE,product_img1,product_img2,product_img3,我的SQL:
$show_info = $pdo("SELECT p.*, pm.*
FROM wp_posts p
JOIN wp_postmeta pm ON p.post_id = pm.meta_id
WHERE p.post_type = 'wpcproduct'"
);
你能幫我顯示此數據爲ID 103?
ID,POST_TITLE(wp_posts)和product_img1,product_img2,product_img3(wp_postmeta)...請幫助我,以顯示這些數據? – 2014-11-01 01:31:32