how to use the LPAD function with COUNT?

0

Just for example:

I'm trying to make a select where a leading zero will be added if the number is less than 10.

Examples:

SELECT COUNT(1);

Returns = > 1

SELECT LPAD(1, 2, 0);

Returns = > 01

SELECT LPAD(COUNT(1), 2, 0);

Returns = > BLOB

How do I use the LPAD function with COUNT , or one that does something similar?

    
asked by anonymous 18.07.2018 / 22:25

1 answer

0

After a little research, find that this may be a bug generated by Drive. So the problem that was occurring with me, will not necessarily happen on other computers.

To correct this, and to have the expected value in my select, I just have to cast this blob.

SELECT CAST(LPAD(COUNT(1), 2, 0) AS CHAR(2));

Returns = > 01

    
19.07.2018 / 19:48