salix/db/changes/231601/00-updateIsVies.sql

5 lines
255 B
MySQL
Raw Normal View History

2023-04-13 06:30:33 +00:00
UPDATE vn.supplier s
JOIN vn.country c ON c.id = s.countryFk
SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1)
WHERE s.isVies = TRUE
AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2);