Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: Results wit...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 6 Topic 3530 of 3799
Post > Topic >>

Re: Results with leading zero

by mail@[EMAIL PROTECTED] (Andreas Guenzel) Jun 16, 2008 at 07:19 AM

--Sig_NX648M1C1f+AuODRTrnEmDj
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Am Mon, 16 Jun 2008 11:48:01 +1000
schrieb novice <user.postgresql@[EMAIL PROTECTED]
>:

You are watching for the lpad() function ...

> I have a table
>=20
> CREATE TABLE problem (
>   problem_id  integer,
>   solution_count integer
>   );
>=20
> INSERT INTO problem VALUES (1001, 4);
> INSERT INTO problem VALUES (1012, 11);
>=20
> SELECT * from problem;
>=20
>  problem_id | solution_count
> ------------+---------------
>        1001 |             4
>        1012 |            11
> (2 rows)
>=20
>=20
> Is there a way I could write a query to produce the following?  I will
> need the leading zero for solution < 10
>=20
>  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)
>=20
> Thanks.
>=20

--Sig_NX648M1C1f+AuODRTrnEmDj
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIVffl00wYKhpVgQgRAimnAJ9J2nRL4EShvEqqypN4pyb044dU3QCfWNtF
3wdgWM+IdU1KGMlGDOyoqmI=
=XWaq
-----END PGP SIGNATURE-----

--Sig_NX648M1C1f+AuODRTrnEmDj--
 




 6 Posts in Topic:
Results with leading zero
user.postgresql@[EMAIL PR  2008-06-16 11:48:01 
Re: Results with leading zero
mail@[EMAIL PROTECTED] (  2008-06-16 07:19:30 
Re: Results with leading zero
andreas.kretschmer@[EMAIL  2008-06-16 08:11:02 
Re: Results with leading zero
andreas.kretschmer@[EMAIL  2008-06-16 08:21:45 
Re: Results with leading zero
user.postgresql@[EMAIL PR  2008-06-16 16:48:04 
Re: Results with leading zero
tsakai@[EMAIL PROTECTED]   2008-06-16 09:35:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:29:39 CST 2008.