I'm using PostgreSQL 11 database, I have Three related tables by foreign keys, T1, T2, and T3.
There is a Many to Many relationship between T1 and T2, so I have used T3 as a joining table.
I'm trying to delete records from these three tables with one query using JOIN, I have tried:
DELETE t1, t3, t2 FROM T1 AS t1
INNER JOIN T3 AS t3 ON t1.id = t3.t1_id
INNER JOIN T2 AS t2 ON t2.id = t3.t2_id
WHERE t1.col = 'something';
I ran this query using pgAdmin, it returns:
ERROR: ERROR: syntax error near « t1 »
LINE 1: DELETE t1, t3, t2 FROM T1 ...
What is the problem with my query syntax here? Am I missing something?