My colleague had an issue in Vertica. He had a set of values in table 1 to be deleted based on the records in a table table2. I didn’t think this would be easy considering VERTICA didn’t support joins when doing deletes unlike MYSQL. But they do have something else. Let me take you through the steps I followed. I created the following table in which I have records

ciiiiii`cic`FDrnnnnnn`rno`iEW((f(essssss`esm`rLHssrasaaeeeeeeIaemIsEEewaeownaewntrrrrrrtritTRlfhnlmhdnlfhdettttttaettwEEereaadeeadereal;atcornncernecornetiiiiiistisrfetmeddetaedaetmedaannnnnnoanyraakkakbttttttbtn:okeeeeekeaeeakeeeealoooooocloa`maaaaaaaanaanaaaaanerei`nkkkkknk\kknkkkk\ppppppepv`e.aaaaa.a_aa_.aaaa_euuuuuuaeueasnnnnndndnndnnnnndabbbbbbtabke\\\\\a\e\\ea\\\\ekllllllekliac_____t_l__lm____laiiiiiidainn\dddddeddd.edddd.nccccccnci_eeeeeeeenieeeen......a\.tilllllIllladlllla(eeeeeen_eid....N...m...msaaaaaaodaassdndsdeinsdeekkkkkkteklIeeaaaeainaeaicaaaaaahlalNcctmtctdmctd\nnnnnneny\\eee\e=e\e=_r(\__=i_=ei_=eivvvvvvs_aiiedieadieadaaaaaatedndda=dakdakllllllaced=ke=ka=kaiuuuuuub\leaaeaneanneeeeeel_dankan.an.tsssssseivik.ak.nk.n,((((((dadadnadaada123123ulna.namnamn,,,,,,sius.tn.te.tea111111ineoseaseiseim,,,,,,ntsmemedede''''''g,(ecec)c)i2222221t\i\\;d000000tn,h_d__111111ha1ii)iii333333em,ndddn------e'gt000000ri2,555555ed0l------c1id222222oi3ka000111rn-et''''''dt0e))))))s,5t;;;;;;-hdod2iafa1stt':ewe))h;;idcahteI);havetodeleterecordsintheearlierone.```

Then I realized there should be another way and used some documentation of Vertica and also checked out Vertica Forums if something was available.

And came up with this:```

delete from eakan
where exists
(select null
from eakan_del
where eakan_del.sec_id=eakan.sec_id
and eakan_del.date=eakan.date
and eakan_del.nameid=eakan.nameid);

ATnhdatbiinmgpol!ieIsntahialtedonilty!thoserowsfromeakanwouldbedeletedwhichmatchesalltheconditionsgiveninthesubqueryselectingstufffromeakan\_del.IamnotsureifthisisnormalSQL.ThisisprobablyVerticaonly.