From: John Ridout <johnridout@ctasystems.co.uk>
To: 'Alessandro Rossi' <alex@sunrise.radiostudiodelta.it>
To: pgsql-sql@postgreSQL.org
Subject: RE: [SQL] RETURN VALUES ON INTEGERS
Date: Wed, 7 Jul 1999 15:36:15 +0100
Message-ID: <000001bec886$161377a0$0301010a@johnridout> (raw)
In-Reply-To: <Pine.LNX.4.05.9907071423230.12067-100000@sunrise.radiostudiodelta.it>
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: johnridout@ctasystems.co.uk, alex@sunrise.radiostudiodelta.it
Subject: Re: [SQL] RETURN VALUES ON INTEGERS
In-Reply-To: <000001bec886$161377a0$0301010a@johnridout>
References: <Pine.LNX.4.05.9907071423230.12067-100000@sunrise.radiostudiodelta.it> <000001bec886$161377a0$0301010a@johnridout>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox