[postgis-users] simple question about views and tables

Robert Buckley robertdbuckley at yahoo.com
Wed Jun 29 13:05:22 PDT 2011


Hi,

I have a table called "windturbines". 
I have created a view called "v_sum_yield".

I would now like to either create another view which consists of both tables 
joined with the column "bez", or join the view to the original table.

The table comprises of single wind turbines and their yield per year. I need to 
sum the yields according to the region. This table then needs to be served as 
wfs/wms through geoserver.

my first step was...

CREATE VIEW v_sum_yield AS
select region, sum(yield) AS result 
from windturbines
group by region

and then to create another view comprising of an left outer join to the original 
table...



CREATE VIEW v_join AS

SELECT *
    FROM windturbines LEFT OUTER JOIN v_sum_yield ON (windturbines.region = 
v_sum_yield.region);

the result is..
ERROR: column "region" specified more than onceSQL Status:42701

however if I just run the selection with the "CREATE VIEW v_join AS"...it works 
fine.

can anyone tell me why?


thanks,

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110629/2220e575/attachment.html>


More information about the postgis-users mailing list