From: | "John Ridout" <johnridout(at)ctasystems(dot)co(dot)uk> |
---|---|
To: | "'Alessandro Rossi'" <alex(at)sunrise(dot)radiostudiodelta(dot)it>, <pgsql-sql(at)postgreSQL(dot)org> |
Subject: | RE: [SQL] RETURN VALUES ON INTEGERS |
Date: | 1999-07-07 14:36:15 |
Message-ID: | 000001bec886$161377a0$0301010a@johnridout |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> I have the following DATABASE.
>
> CREATE TABLE codestatus (
> id int primary key,
> code int,
> status char
> );
>
> code is an int number made at least of 6 numbers.
> (range from 0 up to 999999)
>
> If i do :
>
> select * from codestatus;
>
> I GET:
>
> id|code|status
> --+------+------
> 1| 44111|N
> 2| 123|S
>
> BUT I WOULD LIKE TO GET
>
> id|code|status
> --+------+------
> 1|044111|N
> 2|000123|S
>
> How could I fix the prbolem and get the values as I ned them
> out of the
> select ?
>
> thanks in advance
>
> Alex
>
Try
select id, lpad(code, 6, '0'), status
from codestatus
John
From | Date | Subject | |
---|---|---|---|
Next Message | secret | 1999-07-07 14:56:26 | Good Optimization |
Previous Message | Herouth Maoz | 1999-07-07 12:52:51 | Re: [SQL] RETURN VALUES ON INTEGERS |