pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: DalTech - CTE <CTE@Dal.Ca>
To: Francisco Hernandez <xy0xy0@earthlink.net>
Cc: Pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: variables in SQL??
Date: Wed, 16 Aug 2000 09:11:14 -0300
Message-ID: <00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca> (raw)
References: <000f01c0074f$4dcd87e0$700c2304@francisco>

> 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)




view thread (4+ messages)  latest in thread

Message-ID: <00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca>
Permalink:  ../00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca/
Also on:    postgresql.org/message-id/00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca

 · 

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: CTE@Dal.Ca, xy0xy0@earthlink.net
  Subject: Re: variables in SQL??
  In-Reply-To: <00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca>
  References: <000f01c0074f$4dcd87e0$700c2304@francisco> <00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca>

* 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