I have a table where relationships between two entities are stored in both directions. So if A is linked to B,I have two records - one representing A > B and another B > A.
test=# select * from myt;
id | from_id | to_id
----+---------+-------
1 | 1 | 2
2 | 2 | 1
3 | 1 | 3
4 | 3 | 1
(4 rows)
Is it possible to delete records with SQL so that I have only record to represent each relationship?
It does not matter which one gets deleted.