pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Sequences and Views
2+ messages / 2 participants
[nested] [flat]

* Sequences and Views
@ 1999-01-13 18:28  JP Rosevear <jproseve@arcavia.com>
  0 siblings, 0 replies; 2+ messages in thread

From: JP Rosevear @ 1999-01-13 18:28 UTC (permalink / raw)
  To: pgsql-sql


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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* RE: [SQL] Sequences and Views
@ 1999-01-14 00:23  Jackson, DeJuan <djackson@cpsgroup.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jackson, DeJuan @ 1999-01-14 00:23 UTC (permalink / raw)
  To: JP Rosevear <jproseve@arcavia.com>; pgsql-sql

> 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-01-14 00:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-01-13 18:28 Sequences and Views JP Rosevear <jproseve@arcavia.com>
1999-01-14 00:23 RE: [SQL] Sequences and Views Jackson, DeJuan <djackson@cpsgroup.com>

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