You need to create a trigger that will update the value in the second table when the first is updated.

Structures

First table

id username ban_server bans 

Second table

 id isBanned 

(There are many columns in the tables, I cite only the important ones)

In the bans column of the first table is the id of the second table.

ban_server - 0 or 1

isBanned 0 or 1

It is necessary if in the second table isBanned, it becomes 1, then in the first one it also becomes 1. I think you can take the id of the second table, where 1 was set and look for this number in the bans column of the first table. Then put in the first table 1.

  • You're right. what happened? what problem did you encounter? - Denis
  • problem: failed to implement. - sasha0552

1 answer 1

 CREATE TRIGGER au_t1 AFTER UPDATE ON table1 FOR EACH ROW UPDATE table2 SET isBanned = 1 WHERE id = NEW.id AND NEW.ban_server = 1; 

Plus the same on AFTER INSERT .