[postgis-users] simple question about views and tables
David Fawcett
david.fawcett at gmail.com
Wed Jun 29 13:46:11 PDT 2011
Is is an issue with just using SELECT * and returning multiple columns
named region? Try naming the columns that you want from your join
explicitly.
On Wed, Jun 29, 2011 at 3:05 PM, Robert Buckley
<robertdbuckley at yahoo.com> wrote:
> 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 once
> SQL 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
More information about the postgis-users
mailing list