1

Postgresql-11

select tick_time, nano_secs,
    concat( to_char(tick_time, 'MMDD HH24:MI:SS.US'),
            to_char(nano_secs, '000') )
from ticks
order by tick_time, nano_secs limit 100;

I want to concat 2 strings like above, but it always add a space char between the two strings.

How to prevent it doing that?

Thanks!

0

1 Answer 1

4

It's not concat() it's the to_char() when formatting the integer value. Use the FM modifier to get rid of the spaces:

to_char(nano_secs, 'FM000')
1
  • Got it, Thank you!
    – Leon
    Sep 16, 2022 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.