尝试在 MySql 中创建视图时收到此消息。我也尝试为每一列赋予别名,但仍然收到错误消息。怎么回事!?提前致谢。
错误信息
错误 1060:重复的列名“ID”
代码
CREATE VIEW contactnotes AS
SELECT contact.ID, log.ID, contact.Name, log.notes
FROM log
JOIN contact
ON log.ID = contact.ID
别名尝试
CREATE VIEW contactnotes AS
SELECT contact.ID as id1, log.ID as id2, contact.Name, log.notes
FROM log
JOIN contact
ON id1 = id2