Received: from Alex2.cte.Dal.Ca (Alex2.cte.Dal.Ca [134.190.17.62]) by hub.org (8.10.1/8.10.1) with ESMTP id e7GC8Dn21349 for ; Wed, 16 Aug 2000 08:08:13 -0400 (EDT) Received: from ghost (Ghost.cte.Dal.Ca [134.190.17.89]) by Alex2.cte.Dal.Ca (8.9.3/8.9.3) with SMTP id JAA25526; Wed, 16 Aug 2000 09:22:24 -0300 Message-ID: <00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca> From: "DalTech - CTE" To: "Francisco Hernandez" Cc: "Pgsql-sql" References: <000f01c0074f$4dcd87e0$700c2304@francisco> Subject: Re: variables in SQL?? Date: Wed, 16 Aug 2000 09:11:14 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200008/145 > what im trying to do is have a Sum of a colum.. as it goes forwards I don't think this is what you want, but I suppose it might help.... Table = simple +----------------------------------+----------------------------------+----- --+ | Field | Type | Length| +----------------------------------+----------------------------------+----- --+ | price | int4 | 4 | +----------------------------------+----------------------------------+----- --+ => select price,count(price) from simple group by price; price|count -----+----- 1| 4 2| 7 4| 8 5| 5 7| 16 9| 1 10| 12 (7 rows) => create view simple_v as select price,count(price) from simple group by price; CREATE 19503 1 => select * from simple_v; price|count -----+----- 1| 4 2| 7 4| 8 5| 5 7| 16 9| 1 10| 12 (7 rows) => insert into simple (price) values (5); INSERT 19504 1 => select * from simple_v; price|count -----+----- 1| 4 2| 7 4| 8 5| 6 7| 16 9| 1 10| 12 (7 rows)