0
當前正在使用Microsoft SQL Server 2012(Management Studio),希望用使用來自其他表格的數據的查詢更新表格中的列。用多個表格的結果更新表格
這是查詢我運行:
SELECT
tblGeneralVehicleInformation.EngineerVehicleReg, tblModel.Model_ID,
tblModel.VanOrCar, tblModel.Model, tblMake.Make_ID,
tblMake.WarrantyCars, tblMake.WarrantyVans,
tblMake.WarrantyCarMonths, tblMake.WarrantyVanMonths,
tblGeneralVehicleInformation.PurchaseDate,
tblGeneralVehicleInformation.Mileage
FROM
tblGeneralVehicleInformation
INNER JOIN
tblModel ON tblGeneralVehicleInformation.Model_IDFK = tblModel.Model_ID
INNER JOIN
tblMake ON tblGeneralVehicleInformation.Make_IDFK = tblMake.Make_ID
UPDATE dbo.tblGeneralVehicleInformation
SET WarrantyId = '1'
WHERE (tblModel.VanOrCar = N'Van')
AND (Mileage > WarrantyVans)
AND (DateDiff("M",PurchaseDate,CURRENT_TIMESTAMP) > WarrantyVanMonths)
若本作品或者是你不能夠有UPDATE
語句中像上面的查詢?
感謝您的幫助