Posts Tagged ‘mysql’

Triggers in MySQL

DELIMITER $$ CREATE TRIGGER messages_ins_recipientuser BEFORE INSERT ON messages FOR EACH ROW BEGIN SET NEW.recipient_user_id := (SELECT FROM users WHERE ORDER BY id ASC LIMIT 1); END; $$ delimiter ; Run this in the MySQL prompt; MySQL Administrator (MySQL Query Browser) won’t take it. To see all the database’s triggers: SHOW TRIGGERS; Other […]

Skip to toolbar