nested query

From: Mustapha Amrani <ma10024(at)newton(dot)cam(dot)ac(dot)uk>
To: pgsql-docs(at)postgresql(dot)org
Subject: nested query
Date: 101-01-05 14:04:22
Message-ID: 200101051404.OAA16359@laplace
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

I have two linked tables Table1 and Table2. I have deleted some rows in table1
Now I need two delete the rows in table2 that correspond to the rows
deleted in table1. The two table are linked by field id.
I tried the following but with no success:
delete * from table2 where not exists (select * from table1 where
table2.id=id);

Any help much appreciated.

Mustapha

Browse pgsql-docs by date

  From Date Subject
Next Message Oliver Elphick 1998-06-04 03:46:44 Re: [ADMIN] user auth & passwords