From: | Andreas Guenzel <mail(at)andreas-guenzel(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Results with leading zero |
Date: | 2008-06-16 05:19:30 |
Message-ID: | 20080616071930.16598314@cezanne.sunstrom.priv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Am Mon, 16 Jun 2008 11:48:01 +1000
schrieb novice <user(dot)postgresql(at)gmail(dot)com>:
You are watching for the lpad() function ...
> I have a table
>
> CREATE TABLE problem (
> problem_id integer,
> solution_count integer
> );
>
> INSERT INTO problem VALUES (1001, 4);
> INSERT INTO problem VALUES (1012, 11);
>
> SELECT * from problem;
>
> problem_id | solution_count
> ------------+---------------
> 1001 | 4
> 1012 | 11
> (2 rows)
>
>
> Is there a way I could write a query to produce the following? I will
> need the leading zero for solution < 10
>
> problem_id | solution
> -------------+------------
> 1001 | 01
> 1001 | 02
> 1001 | 02
> 1001 | 04
> 1012 | 01
> 1012 | 02
> 1012 | 03
> 1012 | 04
> 1012 | 05
> 1012 | 06
> 1012 | 07
> 1012 | 08
> 1012 | 09
> 1012 | 10
> 1012 | 11
> (15 rows)
>
> Thanks.
>
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2008-06-16 06:11:02 | Re: Results with leading zero |
Previous Message | novice | 2008-06-16 01:48:01 | Results with leading zero |