I have a mysql table like below
id tetangga1 tetangga2
1 null null
2 1 3
3 1 4
4 4 5
5 4 6
6 6 null
i need to update either tetangga row's value to NULL when one of the row inside the same table is deleted, in example, if i delete the row 1, then the table would look like this
id tetangga1 tetangga2
2 NULL 3
3 NULL 4
4 4 5
5 4 6
6 6 NULL
explanation: row 1 will be deleted, row 2 and 3 tetangga1's value will be updated to null
how can i achieve it?