-1
select p.id,
p.name,
p.phone,
count(phone) as times
from passengers as p
INNER JOIN
(
SELECT l.pickup_time, l.passengers_id
from passengers_log as l
ON p.id = l.passengers_id
GROUP BY p.phone
HAVING Count(phone) > 1
)
我收到此錯誤 「您的SQL語法錯誤;檢查對應於您的MariaDB的服務器版本附近使用正確的語法手冊'ON p.id = l.passengers_id GROUP BY p.phone HAVING Count(phone)> 1)'at line 1「什麼是有sql查詢,集團在內部聯接
即使在編輯之後,此查詢仍是一團糟。你缺少外部查詢的'ON'子句,我無法弄清楚子查詢應該做什麼。 –
'ON'必須是'JOIN'子句的一部分,不能放在'FROM'之後。 – Barmar
你爲什麼要在子查詢中加入'passengers_log',但是沒有在主查詢中選擇任何這些列? – Barmar