MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 7th, 2007, 06:28 PM
heyitsdd heyitsdd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 1 heyitsdd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 7 sec
Reputation Power: 0
Trigger which changes values in another table

Hey all,

I'd like to create a trigger when, upon inserting a record in one table (Reservation), changes the value of an attribute in another table (Flight). I want to do this so that when a flight reservation is made, I can decrement the number of seats available for that particular flight.

What I've come up with so far is:

CREATE TRIGGER decr_on_reserve AFTER INSERT ON Reservation
FOR EACH ROW BEGIN
UPDATE Flight SET Flight.available = Flight.available - 1 WHERE Flight.fid = NEW.rfid;
END;


That is not correct, but I've googled around and haven't found any useful resources yet. Any ideas?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Trigger which changes values in another table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT