Padding result

2007-05-31 Thread Ashley M. Kirchner
Is there a way to automatically pad a query result? For example: select id, user from table +-+--+ | id | user | +-+--+ | 3 | Tinker Bell | | 11 | Peter Pan| | 7 | Dumbo| | 121 | Mickey Mouse |

Re: Padding result

2007-05-31 Thread Baron Schwartz
Hi, Ashley M. Kirchner wrote: Is there a way to automatically pad a query result? For example: select id, user from table +-+--+ | id | user | +-+--+ | 3 | Tinker Bell | | 11 | Peter Pan| | 7 | Dumbo| |

Re: Padding result

2007-05-31 Thread Baron Schwartz
Ashley M. Kirchner wrote: Is there a way to automatically pad a query result? For example: select id, user from table +-+--+ | id | user | +-+--+ | 3 | Tinker Bell | | 11 | Peter Pan| | 7 | Dumbo| | 121 |

Re: Padding result

2007-05-31 Thread Mogens Melander
How about: SELECT LPAD(id,5,'1'),user from table; LPAD(str,len,padstr) Returns the string str, left-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters. mysql SELECT LPAD('hi',4,'??'); - '??hi' mysql