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 > count question
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 3400 of 3599
Post > Topic >>

count question

by user.postgresql@[EMAIL PROTECTED] (novice) Apr 9, 2008 at 11:51 AM

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

-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 5 Posts in Topic:
count question
user.postgresql@[EMAIL PR  2008-04-09 11:51:35 
Re: count question
craig@[EMAIL PROTECTED]   2008-04-09 10:11:39 
Re: count question
rdeleonp@[EMAIL PROTECTED  2008-04-08 22:34:22 
Re: count question
yazicivo@[EMAIL PROTECTED  2008-04-09 08:37:50 
Re: count question
ashish.karalkar@[EMAIL PR  2008-04-09 11:30:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan13V112 Thu Jul 24 12:41:31 CDT 2008.