Is it possible for a trigger to update a row in a table using a value that was deleted? I have a trigger which is updating a column in a different table after the row is inserted:

mysql&gt;delimiter $$

mysql&gt; create trigger status

 after insert on table2

 FOR EACH ROW 

 BEGIN update

 table1 inner join table2

 ON table1.id=table2.id 

 set table1.state=0 ;


Now I want to reset the table1.state=1 whenever the same value gets deleted. Is this possible?
If I understand your question right, what you want is an after delete trigger:

DELIMITER $$
CREATE TRIGGER ad_foo AFTER DELETE on foo
FOR EACH ROW
BEGIN
  update table1 SET table1.state=1 WHERE id=OLD.id;
END$$
DELIMITER ;


Example with just the insert: http://sqlfiddle.com/#!2/974b4/1

Example with insert and delete: http://sqlfiddle.com/#!2/0bf72/1