2012-08-08 97 views

回答

0

嘗試

SELECT title 
FROM  word 

EXCEPT 

SELECT post_title 
FROM  wp_posts 

如果這樣的作品在DBMS取決於你使用的,雖然...

0

您應檢查聯接,可能是它可以幫助你

SELECT title FROM word o 
INNER JOIN wp_posts wp 
ON p.title <> wp.post_title 
+0

加入wp_posts中具有不同標題的所有記錄的單詞中的所有記錄...做出與原始查詢完全不同的內容(並且是SLOW!)。 – 2012-08-08 12:44:40

2

不幸的是,MySQL不支持EXCEPT語法,所以我在這裏使用LEFT JOIN

SELECT title 
FROM word o 

/* try joining a wp_post based on title */ 
LEFT JOIN wp_posts c 
     ON c.post_title = o.title 

/* LEFT JOIN couldn't join anything? Good for us: */ 
WHERE c.ID IS NULL /* you can use any NOT NULL field here, not just ID */ 
相關問題