count question - Mailing list pgsql-sql

From novice
Subject count question
Date
Msg-id ddcb1c340804081851y245f4776g9de74b5715e3a3e@mail.gmail.com
Whole thread Raw
Responses Re: count question  (Craig Ringer <craig@postnewspapers.com.au>)
Re: count question  (Volkan YAZICI <yazicivo@ttmail.com>)
List pgsql-sql
i have a table

CREATE TABLE meter
( meter_id integer NOT NULL, no_of_bays integer, CONSTRAINT meter_pkey PRIMARY KEY (meter_id)
)


INSERT INTO meter(           meter_id, no_of_bays)   VALUES (5397, 2);


INSERT INTO meter(           meter_id, no_of_bays)   VALUES (5409, 3);


select meter_id, no_of_bays from meter;
meter_id | no_of_bays
----------+------------    5397 |          2    5409 |          3


Is it possible to write a query to produce:
meter_id | no_of_bays |   bay_id
----------+------------+-----------    5397 |          2 |   5397-01    5397 |          2 |   5397-02    5409 |
3 |   5409-01    5409 |          3 |   5409-02    5409 |          3 |   5409-03
 


pgsql-sql by date:

Previous
From: Tk421
Date:
Subject: Re: Pattern Matchig
Next
From: Craig Ringer
Date:
Subject: Re: count question