1
我有兩個表,a
和b
。兩個表都包含一個config_data
列。 a
在另一個數據庫中,而b
在另一個數據庫中。從兩個表中選擇值
我想選擇a
不在b
值,以及該在b
但在a
不值。
這是我當前的查詢:
SELECT b.dim2
FROM sakthi_a1.`config_data` AS a
JOIN sakthi_a2.`config_data` AS b
ON a.dim2<>b.dim2
GROUP BY b.dim2
它不工作。我需要一個查詢來解決這個問題。
忘記上述查詢。我知道這是錯的。
我需要根據上面給出的條件從這些表中選擇一個值。可能嗎?
的樣本數據
sakthi_a1.config_data
id dim1 dim2 config_value
1 site is_module_page 0
2 site default_html_header_tpl html_headedr.tpl
3 site facebook test
sakthi_a2.config_data
id dim1 dim2 config_value
1 site is_module_page 0
2 site default_html_header_tpl html_headedr.tpl
3 site error Invalid page
如果我每當我看到'它不工作',沒有錯誤信息就會失去一根頭髮,應該工作,或任何不正確的結果,我會禿頭。到處。 – Bojangles
@JamWaffles:我害怕無處不在:D –