Search Postgresql Archives

Re: How to join to delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chris,

I think the best bet would be to use a nested select:

Delete from A WHERE A.bk = (SELECT bk FROM B) where A.ak = x;

Cheers
Noel

Chris Velevitch wrote:
I'm using pg 7.4.5 on Win XP SP1.

I want to delete rows from a table B, but need to join it to another
table A in order to select the rows in B to be deleted.

Eg. Delete from A join B on (A.bk = B.bk) where A.ak = x;

but only delete rows from B.

How do I acheive this?


Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group
www.flashdev.org.au

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

begin:vcard
fn:Noel Faux
n:Faux;Noel
org:Monash University;Biochemistry and Molecular Biology
adr:;;;Clayton;Vic;3800;Australia
email;internet:noel.faux@xxxxxxxxxxxxxxxxx
tel;work:+61 03 9905 1418
url:http://vbc.med.monash.edu.au/~fauxn
version:2.1
end:vcard


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux