| From: | "DalTech - CTE" <CTE(at)Dal(dot)Ca> |
|---|---|
| To: | "Francisco Hernandez" <xy0xy0(at)earthlink(dot)net> |
| Cc: | "Pgsql-sql" <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: variables in SQL?? |
| Date: | 2000-08-16 12:11:14 |
| Message-ID: | 00ee01c0077b$12e763e0$5911be86@cte.Dal.Ca |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general 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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Len Morgan | 2000-08-16 12:15:13 | Re: date/time functions |
| Previous Message | Volker Paul | 2000-08-16 11:39:24 | Re: [SQL] variables in SQL?? |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martin Christensen | 2000-08-16 12:47:46 | Many-to-one subquery |
| Previous Message | Volker Paul | 2000-08-16 11:39:24 | Re: [SQL] variables in SQL?? |