Pour plus de contenu, connectez-vous !
Skip to main content

Comptes comptables avec trop de 0

-- LIST account with the following pattern XXX0
SELECT
    code,
    substring(code from 1 for 3)
FROM account_account
WHERE char_length(code) = 4
AND substring(code from 4 for 1) = '0'
AND company_id = (select id from res_company where code ='CEY');

-- Update account that have the following pattern XXX0, removing the leading 0
UPDATE account_account
SET code = substring(code from 1 for 3)
WHERE char_length(code) = 4
AND substring(code from 4 for 1) = '0'
AND company_id = (select id from res_company where code ='CEY');