populate value of column - Mailing list pgsql-sql

From novice
Subject populate value of column
Date
Msg-id ddcb1c340708072230pe7e096bx40fe3e8b348a69de@mail.gmail.com
Whole thread Raw
Responses Re: populate value of column  ("Phillip Smith" <phillip.smith@weatherbeeta.com.au>)
Re: populate value of column  (Michael Glaesemann <grzm@seespotcode.net>)
List 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
 


pgsql-sql by date:

Previous
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: Restricting columns by users
Next
From: "Phillip Smith"
Date:
Subject: Re: populate value of column