In my SQL Server, I've created a database and I am trying to export the values from the 2 tables listed below into a new table that I created DM_Location
within the database.
But I keep getting this Error
Violation of PRIMARY KEY constraint 'PK__DM_Locat__BA8F50140E575579'. Cannot insert duplicate key in object 'dbo.DM_Location'. The duplicate key value is (1).
My code:
INSERT INTO DM_Location (Authority_Id, FacilityAddress, FacilityPostcode)
SELECT AuthorityId, FacilityAddress, FacilityPostcode
FROM dbo.2015_2016
UNION
SELECT DISTINCT AuthorityId, FacilityAddress, FacilityPostcode
FROM dbo.2016_2017
Any help would be appreciated! Thanks
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…