Re: variables in SQL?? - Mailing list pgsql-sql

From DalTech - CTE
Subject Re: variables in SQL??
Date
Msg-id 00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca
Whole thread Raw
In response to variables in SQL??  ("Francisco Hernandez" <xy0xy0@earthlink.net>)
List pgsql-sql
> 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)



pgsql-sql by date:

Previous
From: Volker Paul
Date:
Subject: Re: variables in SQL??
Next
From: Martin Christensen
Date:
Subject: Many-to-one subquery