Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger update based on another table

Status
Not open for further replies.

StuartBombay

Programmer
Feb 11, 2008
56
US
I think I know what's wrong here. The trigger doesn't know what I mean by the small_schools table. I needs someplace to hold the data from that table (cursor??) to check against, rather than checking against the small_schools table.
What I'm trying to accomplish is change the prognum for usernames if they are in the small_schools table.
I'm a bit lost with how to put this trigger together.
Code:
CREATE TRIGGER tr_small_schools
BEFORE INSERT ON people
FOR EACH ROW BEGIN
   IF people.username In(small_schools.username)
     SET people.prognum = small_schools.newprog;
   END IF;
END;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top