X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=sql%2FPg-upgrade2%2Fdelete_cvars_on_trans_deletion_add_shipto.sql;h=d2f887b4368d8b462580d2a87a4e6f27a9a5685c;hb=a6e0a7f493d24aec0eebede85eeaa5e724bd2e11;hp=ab1d1a4f55eab76712aaa6ac2d0bd708f6cdc717;hpb=349cde397536c1fd61b8a8a69fe0c6709bb21b46;p=kivitendo-erp.git diff --git a/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql b/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql index ab1d1a4f5..d2f887b43 100644 --- a/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql +++ b/sql/Pg-upgrade2/delete_cvars_on_trans_deletion_add_shipto.sql @@ -4,7 +4,7 @@ -- 1.6 Alle benutzerdefinierten Variablen löschen, für die es keine -- Einträge in shipto mehr gibt. -DELETE FROM custom_variables WHERE EXISTS +DELETE FROM custom_variables WHERE id IN (SELECT cv.id FROM custom_variables cv LEFT JOIN custom_variable_configs cvc ON (cv.config_id = cvc.id) WHERE module LIKE 'ShipTo' AND NOT EXISTS (SELECT shipto_id FROM shipto WHERE shipto_id = cv.trans_id));