RE: [SQL] Sequences and Views

From: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
To: JP Rosevear <jproseve(at)arcavia(dot)com>, pgsql-sql(at)postgreSQL(dot)org
Subject: RE: [SQL] Sequences and Views
Date: 1999-01-14 00:23:45
Message-ID: F10BB1FAF801D111829B0060971D839F5DC768@cpsmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Chatchawan Boonraksa 1999-01-14 00:59:42 Geometry filed type
Previous Message Jackson, DeJuan 1999-01-13 23:38:00 RE: [SQL] Text type