2017-07-18 56 views
0

加入三家外資表我有三個外國表(visits, parts, problemdescription)有一個名爲公共列:「startDateTime在PostgreSQL

我想加入他們,所以我用下面的查詢:

select v."startDateTime", p.znumber, pd.remark FROM visits v 
INNER JOIN parts p 
on s."startDateTime"=p."startDateTime" INNER JOIN problemdescription pd 
on s."startDateTime"=pd."startDateTime"; 

但我得到這個錯誤的postgres:

ERROR: missing FROM-clause entry for table "s"

回答

3

用v替換s,因爲你沒有表「s」。

select v."startDateTime", p.znumber, pd.remark FROM visits v 
INNER JOIN parts p 
on v."startDateTime"=p."startDateTime" INNER JOIN problemdescription pd 
on v."startDateTime"=pd."startDateTime"; 
+2

歡迎來到Stackoverflow並恭喜你的答案:) – AlexanderMP