0
我需要合併兩個查詢:兩個查詢合併
首先查詢:
SELECT `p`.`name`, `posts`.*
FROM `polls` `p`, `posts`
WHERE `p`.`id` = `posts`.`guid`
AND `first` = {$id}
AND `text` LIKE ?
與...第二個查詢:
SELECT SUM(`deleted` = 0) AS 'posts'
FROM `posts`
WHERE `first`
NOT IN
(
SELECT `id`
FROM `posts`
WHERE `deleted` = 1
AND `first` = `id`
) AND `first` = {$fid}
是否有任何機會,以合併它們?
好了,你可以幫我這個'UNION'?因爲我已經嘗試了很多方法,查詢總是失敗。 – Isarius
我認爲'UNION'在這種情況下不會起作用,因爲'SELECT'語句有不同的列數。 – Isarius