DELIMITER $$
CREATE TRIGGER `InitialCuring_update` BEFORE UPDATE ON `specimen_register`
FOR EACH ROW BEGIN
DECLARE DateOFJob1 Date;
DECLARE SampleTime1 varchar(50);
DECLARE Curing_LCDate1 varchar(50);
DECLARE Curing_LCTime1 varchar(50);
DECLARE DT1 DATETIME;
DECLARE DT2 DATETIME;
DECLARE ReportD Date;
SELECT `DateOfJob`,`Sample_Time`,`Curing_LCDate`,`Curing_LCTime`,`ReportDue`
INTO DateOFJob1,SampleTime1,Curing_LCDate1,Curing_LCTime1,ReportD
FROM job_register j, test_register t
WHERE j.JID = t.ParentID
AND t.fts = NEW.FTS;
SET DT1 = STR_TO_DATE(CONCAT(DateOFJob1, ' ', SampleTime1), '%Y-%m-%d %H%i');
SET DT2 = STR_TO_DATE(CONCAT(Curing_LCDate1, ' ', Curing_LCTime1), '%Y-%m-%d %H%i');
SET NEW.Initial_Cure = time_format(timediff(DT2,DT1),'%H');
SET NEW.Due_Date = DATE_ADD(DateOFJob1,INTERVAL NEW.Age DAY);
IF (NEW.Due_Date > ReportD) THEN
SET NEW.ReportDue = NEW.Due_Date;
END IF;
END $$
DELIMITER ;
返回错误
#1054 - Unknown column 'ReportDue' in 'NEW'
ReportDue在job_register表中,我尝试了各种各样的事情,我似乎无法解决这个问题。 我尝试过使用job_register.ReportDue和别名j,但它只是工作了。