pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ashish <ashish.karalkar@netcore.co.in>
To: Volkan YAZICI <yazicivo@ttmail.com>
Cc: novice <user.postgresql@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: count question
Date: Wed, 09 Apr 2008 11:30:19 +0530
Message-ID: <47FC5B73.1040300@netcore.co.in> (raw)
In-Reply-To: <87ej9fr3kh.fsf@alamut.mobiliz.com.tr>
References: <ddcb1c340804081851y245f4776g9de74b5715e3a3e@mail.gmail.com>
	<87ej9fr3kh.fsf@alamut.mobiliz.com.tr>

Volkan YAZICI wrote:
> On Wed, 9 Apr 2008, novice <user.postgresql@gmail.com> writes:
>   
>> 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
>>     
>
> Shouldn't this function be the responsitibility of client software,
> instead of database?
>
>
> Regards.
>   

May be this will help you


ashish=# select
meter_id,no_of_bays,meter_id||'-'||generate_series(1,no_of_bays) from meter;
meter_id | no_of_bays | ?column?
----------+------------+----------
5397 | 2 | 5397-1
5397 | 2 | 5397-2
5409 | 3 | 5409-1
5409 | 3 | 5409-2
5409 | 3 | 5409-3

With Regards
Ashish

===================================================================

sms START NETCORE to 575758 to get updates on Netcore's enterprise
products and services

sms START MYTODAY to 09845398453 for more information on our mobile
consumer services or go to http://www.mytodaysms.com

===================================================================

view thread (9+ messages)

Message-ID: <47FC5B73.1040300@netcore.co.in>
Permalink:  ../47FC5B73.1040300@netcore.co.in/
Also on:    postgresql.org/message-id/47FC5B73.1040300@netcore.co.in

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ashish.karalkar@netcore.co.in, yazicivo@ttmail.com, user.postgresql@gmail.com
  Subject: Re: count question
  In-Reply-To: <47FC5B73.1040300@netcore.co.in>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox