我正在爲我的數據庫創建一個視圖,我正在連接3個表,用戶,personal_info和contact_info,如果您發現我的Select語句中有很多列名稱,因爲我不想包含主鍵但它看來我這裏有一個錯誤,看看如何在MySQL中加入3個表?
CREATE VIEW `payroll`.`new_view` AS
Select employee_id,employee_password,First_Name,Middle_Initial,
Last_Name,Date_Of_Birth,Beneficiaries,Home_Number,Address,Mobile_Number,Email_Address
From USER
LEFT JOIN personal_info on idUser = idPersonal_Info,
FULL JOIN contact_info on idUser = idContact_Info
的誤差
ERROR 1146: Table 'payroll.full' doesn't exist
SQL Statement:
CREATE OR REPLACE VIEW `payroll`.`new_view` AS
Select employee_id,employee_password,First_Name,Middle_Initial,
Last_Name,Date_Of_Birth,Beneficiaries,Home_Number,Address,Mobile_Number,Email_Address
From USER
LEFT JOIN personal_info on idUser = idPersonal_Info,
FULL JOIN contact_info on idUser = idContact_Info
ü可以添加每個表的結構?因爲很難找出哪些列屬於哪個表。 – Shirish11
MySQL中沒有'FULL JOIN'。你必須用'LEFT'和'RIGHT'加入'UNION'來模擬它。 –
您也有一個無意義的逗號,後面是:'LEFT JOIN個人信息關於idUser = idPersonal_Info,' –