我要使用的一些join语句有问题。我有两个需要合并的表,两个表都包含了它们的所有信息。它们如下。

INSTITUTION
IName | ALocation_ID | IPicture

ADDRESS
ALocation_ID | AStreet | AZip | ...(other relevant fields)


我一直在尝试使用:

CREATE VIEW InstitutionView
AS SELECT * FROM INSTITUTION
LEFT JOIN ADDRESS
ON INSTITUTION.ALocation_ID=ADDRESS.ALocation_ID;


但是我收到的错误说明了有关重复列的问题。我究竟做错了什么?

最佳答案

您将不得不单独选择列。希望这对您有所帮助。

CREATE VIEW InstitutionView
AS
SELECT address.id,address.iname,address.alocation_id,ipicture,institution.astreet,institution.azip
FROM INSTITUTION
LEFT JOIN ADDRESS
ON INSTITUTION.ALocation_ID=ADDRESS.ALocation_ID;

10-06 00:47