From 316571cdf8102f764222121187246bcb9f6d0553 Mon Sep 17 00:00:00 2001 From: Ruslan Getmansky Date: Fri, 8 Sep 2017 14:29:33 +0300 Subject: [PATCH] P5-1679: Populate reseller texts --- migrations/000.046.sql | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 migrations/000.046.sql diff --git a/migrations/000.046.sql b/migrations/000.046.sql new file mode 100644 index 0000000..35ba1a8 --- /dev/null +++ b/migrations/000.046.sql @@ -0,0 +1,30 @@ +-- P5-1679 + +UPDATE contract_customers AS t_upd +SET ( + "reseller-companyname", + "reseller-address", + "reseller-zipcode", + "reseller-city", + "reseller-email", + "reseller-phone" +) = ( + SELECT + companyname, + address, + zipcode, + city, + email, + phone + FROM contract_customers AS t_sel + WHERE t_sel.contractcustomerid = t_upd.contractcustomerid +) +WHERE + dealerstore + AND "reseller-companyname" IS NULL + AND "reseller-address" IS NULL + AND "reseller-zipcode" IS NULL + AND "reseller-city" IS NULL + AND "reseller-email" IS NULL + AND "reseller-phone" IS NULL +; \ No newline at end of file