MySQL Trigger to update another table?

Try AFTER INSERT ON `cinemax`. `bookings` instead of AFTER UPDATE ON `cinemax`. `bookings`.

I get the following error when trying to insert a new row now "Unknown column 'cinemax.bookings. SeatID' in 'where clause'" – Kentz Mar 31 at 15:20 Bookings does have SeatID, I just called it SeatAvailabilityID in my question to avoid some confusion. I edited the question so that it's exactly like the database.

Thanks for the help so far. You're definitely right about the INSERT ON instead of UPDATE ON. – Kentz Mar 31 at 16:10 @Kentz there is something wrong with query -- and very likely a typo in query in name of column.

Try running the query independently. – Nishant Mar 31 at 16:16.

It's a couple of months late, but I decided to give it a quick shot before handing in the overall assignment. In the meantime I switched to postgres as it seemed to offer more functionality (albeit not as user friendly). I first had to create a trigger function: CREATE OR REPLACE FUNCTION updateseatavailable() RETURNS trigger AS $BODY$ BEGIN IF (TG_OP = 'INSERT') THEN UPDATE "SeatAvailability" SET "Available"='FALSE' AND "BookingID"=NEW."BookingID" WHERE "SeatAvailabilityID"=NEW.

"SeatID"; ELSIF (TG_OP = 'DELETE') THEN UPDATE "SeatAvailability" SET "Available"='TRUE' WHERE "SeatAvailabilityID"=OLD. "SeatID"; END IF; RETURN NEW; END; $BODY$ LANGUAGE plpgsql VOLATILE and then simply call the function/procedure from a trigger: CREATE TRIGGER UpdateSeatAvailable AFTER INSERT OR DELETE ON "Bookings" FOR EACH ROW EXECUTE PROCEDURE updateSeatAvailable(); I wasn't able to get the BookingID in SeatAvailability to update for some reason (on Insert nothing happened and on Delete I got an error telling me Available cannot be null, even though I was changing the BookingID) so I omitted that in postgres,and implemented it with Java instead.It's not the best way but still better than nothing. I decided to post my solution just in case someone has a similar problem and stumbles upon this question.

I don't use MySQL but does SET NEW. Billing_country Need to be select NEW. Billing_country.

I don't use MySQL but does SET NEW. Billing_country = Need to be select NEW. Billing_country.

I believe your "SET" line is missing a couple of things and should read something like this: SET NEW. Billing_country = (SELECT country_name FROM cms. Country WHERE cms.country.

Country_id = NEW. Country_id).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions