From: | novice <user(dot)postgresql(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | populate value of column |
Date: | 2007-08-08 05:30:47 |
Message-ID: | ddcb1c340708072230pe7e096bx40fe3e8b348a69de@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I have a table
CREATE TABLE meter
(
meter_id integer NOT NULL,
area_no integer NOT NULL,
CONSTRAINT meter_pkey PRIMARY KEY (meter_id)
) ;
INSERT INTO meter(meter_id, no_of_bays) VALUES (1001, 4);
INSERT INTO meter(meter_id, no_of_bays) VALUES (1012, 6);
select meter_id, area_no from meter;
meter_id | no_of_bays
----------+------------
1001 | 4
1012 | 6
How can I generate the following result?
meter_id | bay
----------+------------
1001 | 01
1001 | 02
1001 | 03
1001 | 04
1012 | 01
1012 | 02
1012 | 03
1012 | 04
1012 | 05
1012 | 06
From | Date | Subject | |
---|---|---|---|
Next Message | Phillip Smith | 2007-08-08 05:37:22 | Re: populate value of column |
Previous Message | Kev | 2007-08-07 19:18:02 | Re: Using function like where clause |