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 > Re: count quest...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 5 Topic 3400 of 3631
Post > Topic >>

Re: count question

by ashish.karalkar@[EMAIL PROTECTED] (ashish) Apr 9, 2008 at 11:30 AM

This is a multi-part message in MIME format.
--------------000000070801060401050905
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Volkan YAZICI wrote:
> On Wed, 9 Apr 2008, novice <user.postgresql@[EMAIL PROTECTED]
> 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


a****sh=# 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
A****sh

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

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

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


--------------000000070801060401050905
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=us-ascii" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Volkan YAZICI wrote:
<blockquote cite="mid:87ej9fr3kh.fsf@[EMAIL PROTECTED]
" type="cite">
  <pre wrap="">On Wed, 9 Apr 2008, novice <a class="moz-txt-link-rfc2396E"
href="mailto:user.postgresql@[EMAIL PROTECTED]
">&lt;user.postgresql@[EMAIL PROTECTED]
>
writes:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Shouldn't this function be the responsitibility of client software,
instead of database?


Regards.
  </pre>
</blockquote>
<br>
May be this will help you<br>
<br>
<br>
a****sh=# select
meter_id,no_of_bays,meter_id||'-'||generate_series(1,no_of_bays) from
meter;<br>
&nbsp;meter_id | no_of_bays | ?column?<br>
----------+------------+----------<br>
&nbsp;&nbsp;&nbsp;&nbsp; 5397
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 | 5397-1<br>
&nbsp;&nbsp;&nbsp;&nbsp; 5397
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 | 5397-2<br>
&nbsp;&nbsp;&nbsp;&nbsp; 5409
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 | 5409-1<br>
&nbsp;&nbsp;&nbsp;&nbsp; 5409
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 | 5409-2<br>
&nbsp;&nbsp;&nbsp;&nbsp; 5409
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 | 5409-3<br>
<br>
With Regards<br>
A****sh<br>
</body>
<pre>

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

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

===================================================================
</pre>
</html>

--------------000000070801060401050905--
 




 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
tan12V112 Thu Aug 21 23:01:56 CDT 2008.