pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jackson, DeJuan <djackson@cpsgroup.com>
To: JP Rosevear <jproseve@arcavia.com>
To: pgsql-sql@postgreSQL.org
Subject: RE: [SQL] Sequences and Views
Date: Wed, 13 Jan 1999 18:23:45 -0600
Message-ID: <F10BB1FAF801D111829B0060971D839F5DC768@cpsmail> (raw)

> I'm trying to label rows when creating a view with the numbers 1...n,
> where n is the number of items in a view.  Since views are requeryed
> when used in a select statement, using sequences breaks the 1 to n
> numbering.
> 
> Under oracle the label was produced by the 'rownum' attribute.
> 
> Suggestions?
> -JP

If it's just one table with unique values that you can group by then you
should be able to adapt this:
test=> select * from blah2;                          
a    
-----
AAAAA
BBBBB
aaaaa
bbbbb
(4 rows)

test=> select count(b1.oid), b1.a from blah2 b1, blah2 b2 where
b1.oid>=b2.oid group by b1.a;
count|a    
-----+-----
    1|AAAAA
    2|BBBBB
    3|aaaaa
    4|bbbbb
(4 rows)

Hope this helps,
	-DEJ



view thread (2+ messages)

Message-ID: <F10BB1FAF801D111829B0060971D839F5DC768@cpsmail>
Permalink:  ../F10BB1FAF801D111829B0060971D839F5DC768@cpsmail/
Also on:    postgresql.org/message-id/F10BB1FAF801D111829B0060971D839F5DC768@cpsmail

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: djackson@cpsgroup.com, jproseve@arcavia.com
  Subject: Re: [SQL] Sequences and Views
  In-Reply-To: <F10BB1FAF801D111829B0060971D839F5DC768@cpsmail>
  References: <F10BB1FAF801D111829B0060971D839F5DC768@cpsmail>

* 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