On 03/09/2012 18:30, Robert Buckley wrote: > Now even stranger is that I can´t update a column with the query. > > Update energie.tennet_auswertung_2010 set "Test"=( > > SELECT round(100*ges_kw_zgb/total.totalsum, 2) from > energie.tennet_auswertung_2010, > (select sum(ges_kw_zgb) totalsum From energie.tennet_auswertung_2010) as > total > ); > > ERROR: more than one row returned by a subquery used as an expression The answer's in the error message - the subquery is returning more than one row. If you're using a subquery as an expression to be used to update the column, then it can only return one row - otherwise which row should be used for the update? Try running the subquery on its own, and play with it until you get a single value. Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@xxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general