DELETE using JOIN, is that possible in Vertica?

Moderator: NorbertKrupa

Post Reply
jagadeesh
Newbie
Newbie
Posts: 21
Joined: Tue Feb 05, 2013 9:36 am

DELETE using JOIN, is that possible in Vertica?

Post by jagadeesh » Sun May 05, 2013 4:22 pm

Can we DELETE records based on JOIN.

that is delete records which are common between the tables.

Ex:

Delete from table_A join table_b
on a.col1=b.col1;

i am getting an error 4856: Syntax error at or near "join"

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1778
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: DELETE using JOIN, is that possible in Vertica?

Post by JimKnicely » Tue May 07, 2013 1:22 pm

Hi!

You must have been using MySQL where that syntax is ok :)

This DELETE statement will do the same thing in Vertica:

Code: Select all

DELETE FROM table_A 
 WHERE EXISTS (SELECT NULL
                 FROM table_b 
                WHERE table_b.col1 = table_A.col1);
Please make sure to test it!
Jim Knicely

Image

Note: I work for HPE. My views, opinions, and thoughts expressed here do not represent those of my employer.

jagadeesh
Newbie
Newbie
Posts: 21
Joined: Tue Feb 05, 2013 9:36 am

Re: DELETE using JOIN, is that possible in Vertica?

Post by jagadeesh » Tue May 07, 2013 6:46 pm

Oh ya... co-related...

Thanks... this works...

Post Reply

Return to “New to Vertica Database Development”