1

Temat: SUM in postgres

Ostatnio edytowany przez Rafik83 (2012-01-30 16:45:28)

2

Odp: SUM in postgres

Drop Table If Exists table3;
Create Table table3 (
        pole_1 integer Not Null,
        pole_2 integer Not Null,
        pole_3 integer Not Null
);

Drop View If Exists table3_view;
Create View table3_view As
        Select pole_1, pole_2, pole_3,
                pole_1 + pole_2 + pole_3 As total
        From table3;

Insert Into table3 Values (1, 3, 5), (2, 4, 6), (10, 20, 30);
INSERT 0 3
Select * From table3_view ;
 pole_1 | pole_2 | pole_3 | total 
--------+--------+--------+-------
      1 |      3 |      5 |     9
      2 |      4 |      6 |    12
     10 |     20 |     30 |    60
(3 rows)

Ostatnio edytowany przez gszpetkowski (2012-01-30 21:18:09)

3

Odp: SUM in postgres

Dzięki za odp, teraz wszystko jasne