5
I need to complete the amount of numbers to display on the screen, what would that be. a amount which would be an example: 20 need to fill 15 characters with 0,
Example: 000000000000020.
A friend of mine showed me in Excel a way that he uses the CONCAT and then takes only the last 15 numbers,with that the id can be 1,100,100 etc ... that it will always be 15 numbers that would be the zeroes plus the quantity.
I looked here on the site and also on the internet but I could not do what I need,.
This result I bring from Mysql, if it is easier in Mysql I can also use.
Here is an example of the query I tried to make:
SELECT
MAX(cup_id) AS CUPOM,
MAX(DATE_FORMAT(c.cup_data_hora, '%d/%m/%Y')) AS DATA,
MAX(c.cup_data_hora) AS HORA,
MAX(l.loja_num) AS LOJA_NUM,
MAX(l.loja_desc) AS LOJA_NOME,
MAX(l.loja_end) AS END_LOJA,
MAX(u.usu_cod) AS USU_ID,
MAX(u.usu_nome) AS USU_NOME,
MAX(v.vas_cod_emporium) AS COD_EMPORIUM,
MAX( v.vas_desc) AS VASILHAME,
MAX(c.cup_quantidade) AS QUANTIDADE,
CONCAT(c.cup_quantidade,'000000000000') AS QUANTIDADE_15
FROM cupom AS c
LEFT JOIN loja AS l ON c.cup_loja = l.loja_num
LEFT JOIN vasilhame AS v ON c.cup_vasilhame = v.vas_id
LEFT JOIN usuarios AS u ON c.cup_usu_id = u.usu_cod
WHERE cup_loja =4**
vc want to set a number of with fixed digits, for example 5, if the number is 20 he put 3 zeros left?
– rray
Already tried to use the field in the table with ZEROFILL ?
– Diego Souza
@rray that’s right
– Chefe Druida
@Zoom , I got with the help of our colleague rray ,more then I will see this part of you too,thanks for the return.
– Chefe Druida