DustySucks420 DustySucks420 - 9 days ago 5
MySQL Question

trigger error : SQL Error (1193): Unknown system variable 'Showedup'

CREATE TRIGGER `ScheduleCheckin` AFTER INSERT ON `Checkins` FOR EACH ROW BEGIN
SET SCHEDULE.Showedup = CHECKINS.CheckInDateTime,
Where SCHEDULE.MemberID = CHECKINS.MemberID;
END


The point of this trigger is to take the Check-in time of the client and put it into the column under the Schedule table that tells the admin what time the client showed up.

Answer

I think you have some grammer problem.
Some examples:

mysql> CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
Query OK, 0 rows affected (0.03 sec)

mysql> CREATE TRIGGER ins_sum BEFORE INSERT ON account
    -> FOR EACH ROW SET @sum = @sum + NEW.amount;
Query OK, 0 rows affected (0.06 sec)

The NEW is the new row. The OLD is the old row. I think you may need to change your code:

CREATE TRIGGER `ScheduleCheckin` AFTER INSERT ON `Checkins` FOR EACH ROW 
BEGIN
update SCHEDULE 
SET SCHEDULE.Showedup = NEW.CheckInDateTime
where SCHEDULE.MemberID = NEW.MemberID;
END