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
---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at
http://www.postgresql.org/about/donate