I ask the community for advice. There is a request:

select f14, replace(sum(replace(f14,'+-','-')),'.0','') from Table where f1=602 group by f14; 

f14 has numbers in the format: +-0000008334
I get a number in the format -16668 after the request

How can you add zeros in the resulting number if the field is always 10 digits and one digit at the beginning of +/- ?
Thank.

    1 answer 1

     select f14, printf("%011d",sum(replace(f14,'+-','-'))) from Table where f1=602 group by f14; 

    printf (FORMAT, ...)

    The printf (FORMAT, ...) SQL function like the sqlite3_mprintf () function. The output string is used with subsequent arguments. If the FORMAT argument is missing or NULL then the result is NULL. The% n format is silently ignored and does not consume an argument. The% p format is an alias for% X. The% z format is interchangeable with% s. If there is a null value for% s.

    • What you need, thanks. - Evgeniy A