Hi
I'm trying to add records to the asset_details table. Basically for every record that exists for a Switch (SWIT) currently I want to create a corresponding record for the parent asset, a switch site (SWSI).
The primary key on the asset_details table is the Asset_ID so I would not expect the key violation error since I'm simply trying to replace the child asset (SWIT) with its parent asset ID for the new record.
I've attached the database to this thread which includes my feeble attempt at the append query - "Insert_Query" which is as follows:
INSERT INTO asset_details ( Asset_ID, Detail_Code, Detail_Text, Detail_Date )
SELECT asset_parent.Parent_Asset, asset_details.Detail_Code, asset_details.Detail_Text, asset_details.Detail_Date
FROM asset INNER JOIN (asset_parent INNER JOIN asset_details ON asset_parent.Asset_ID = asset_details.Asset_ID) ON asset.Asset_ID = asset_details.Asset_ID
WHERE (((asset_details.Detail_Code)='SWMT') AND ((asset.Asset_ID)=[asset_parent].[Asset_ID]));
Any help is much appreciated
Cheers
Luigi
I'm trying to add records to the asset_details table. Basically for every record that exists for a Switch (SWIT) currently I want to create a corresponding record for the parent asset, a switch site (SWSI).
The primary key on the asset_details table is the Asset_ID so I would not expect the key violation error since I'm simply trying to replace the child asset (SWIT) with its parent asset ID for the new record.
I've attached the database to this thread which includes my feeble attempt at the append query - "Insert_Query" which is as follows:
INSERT INTO asset_details ( Asset_ID, Detail_Code, Detail_Text, Detail_Date )
SELECT asset_parent.Parent_Asset, asset_details.Detail_Code, asset_details.Detail_Text, asset_details.Detail_Date
FROM asset INNER JOIN (asset_parent INNER JOIN asset_details ON asset_parent.Asset_ID = asset_details.Asset_ID) ON asset.Asset_ID = asset_details.Asset_ID
WHERE (((asset_details.Detail_Code)='SWMT') AND ((asset.Asset_ID)=[asset_parent].[Asset_ID]));
Any help is much appreciated
Cheers
Luigi