Received: from bjke.com (firewall-user@ganymede.bjke.com [144.210.8.38]) by hub.org (8.9.1/8.9.1) with ESMTP id TAA25701 for ; Wed, 13 Jan 1999 19:22:21 -0500 (EST) (envelope-from djackson@cpsgroup.com) Received: by bjke.com; id SAA25517; Wed, 13 Jan 1999 18:21:38 -0600 (CST) Received: from cpsmail.cpsgroup.com(144.210.12.11) by gauntlet.bjke.com via smap (4.1) id xmaa25326; Wed, 13 Jan 99 18:21:20 -0600 Received: by cpsmail with Internet Mail Service (5.0.1458.49) id ; Wed, 13 Jan 1999 18:23:47 -0600 Message-ID: From: "Jackson, DeJuan" To: JP Rosevear , pgsql-sql@postgreSQL.org Subject: RE: [SQL] Sequences and Views Date: Wed, 13 Jan 1999 18:23:45 -0600 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1458.49) Content-Type: text/plain > 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