List:General Discussion« Previous MessageNext Message »
From:Baron Schwartz Date:June 1 2007 12:43am
Subject:Re: Padding result
View as plain text  
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        |
>    | 121 | Mickey Mouse |
>    +-----+--------------+
> 
>    What I really want is:
> 
>    +-------+--------------+
>    |    id | user         |
>    +-------+--------------+
>    | 10003 | Tinker Bell  |
>    | 10011 | Peter Pan    |
>    | 10007 | Dumbo        |
>    | 10121 | Mickey Mouse |
>    +-------+--------------+
> 
> 

Sure.  select 10000 + id as id, user from table.  There is also an 
LPAD() function.

Baron
Thread
Padding resultAshley M. Kirchner1 Jun
  • Re: Padding resultBaron Schwartz1 Jun
  • Re: Padding resultBaron Schwartz1 Jun
  • Re: Padding resultMogens Melander1 Jun