0
我試圖合併這兩個查詢,但我沒有這麼熱與MySQL。我懷疑我需要使用INNER JOIN
或子查詢?mysql合併兩個查詢
我試圖合併一個自定義分類與插件。該插件要求我使用SQL訪問我的Wordpress數據庫。下面是從插件查詢:
SELECT p.*
FROM {$wpdb->prefix}most_popular mp
INNER JOIN {$wpdb->prefix}posts p ON mp.post_id = p.ID
WHERE
p.post_type = '%s' AND
p.post_status = 'publish'
{$order}
LIMIT %d
這是我的分類
SELECT SQL_CALC_FOUND_ROWS wp_posts.*
FROM wp_posts
INNER JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id)
WHERE 1=1
AND (wp_term_relationships.term_taxonomy_id IN (38))
AND wp_posts.post_type = 'post'
AND (wp_posts.post_status = 'publish')
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date
DESC LIMIT 0, 10
我應該如何去融入一個查詢這一切都過濾掉的內容查詢?
一旦你想成爲你的本壘打? – 2012-04-24 16:13:53
@DavidYell我會把它當成收據來閱讀我的問題:P – Jacksonkr 2012-04-24 16:22:20