robertdbuckley
Neuer Benutzer
- Beiträge
- 2
Hi,
My first thread in this forum!
I having problems constructing a query in postgresql. The query works as a simple select statement as follows...
SELECT (ges_kw_zgb / (select sum(ges_kw_zgb) From energie.tennet_auswertung_2010)) FROM energie.tennet_auswertung_2010
Table: energie.tennet_auswertung_2010
Field :ges_kw_zgb
I would like to update another field based on this result and loop through each field to calculate it for the whole table. However, when I try this I get the error " more than one row returned by a subquery used as an expression"
The expression take the values from the field "ges_kw_zgb" and divides it by the sum of all the values in the same field thus giving the proportion that row is of the total.
So I need to reconstruct the statement and this is where I´m stuck,
Any help would be much appreciated.
Cheers,
Robert
My first thread in this forum!
I having problems constructing a query in postgresql. The query works as a simple select statement as follows...
SELECT (ges_kw_zgb / (select sum(ges_kw_zgb) From energie.tennet_auswertung_2010)) FROM energie.tennet_auswertung_2010
Table: energie.tennet_auswertung_2010
Field :ges_kw_zgb
I would like to update another field based on this result and loop through each field to calculate it for the whole table. However, when I try this I get the error " more than one row returned by a subquery used as an expression"
The expression take the values from the field "ges_kw_zgb" and divides it by the sum of all the values in the same field thus giving the proportion that row is of the total.
So I need to reconstruct the statement and this is where I´m stuck,
Any help would be much appreciated.
Cheers,
Robert