delete from joined tables

From: ann hedley <ann(dot)hedley(at)ed(dot)ac(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: delete from joined tables
Date: 2006-03-28 11:04:48
Message-ID: 44291850.1080909@ed.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi

I want to delete rows out of table1 that match a selection based on
table2, tables joined on uniqueID. i.e.

table1
Column | Type | Modifiers
----------+-----------------------+-----------
est_id | character varying(15) | not null
sequence | text |

table2
Table "public.est"
Column | Type | Modifiers
----------+-----------------------+-----------
est_id | character varying(15) | not null
clus_id | character varying(10) | not null

select * from table1 natural join table2 where clus_id like 'NVC%';

Selects the ones I want to delete but

delete from table1 natural join table2 where clus_id like 'NVC%';

gives me a parse error at natural and all other delete commands I've
tried fail.

I can add the clus_id column to table1 and then delete on that column
but surely I should be able to do it in one step?

Thanks

Ann

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Christoph Della Valle 2006-03-28 11:20:09 Re: delete from joined tables
Previous Message Christoph Frick 2006-03-28 10:07:22 Re: Transfer from MySQL to PostgreSQL