I'm trying to run this query in a PostGIS 2 database:

create TABLE data.agri_grc as select
id, code_00,
ST_Intersection(data.agri.geom,data.grc_bor.geom) as geom from

But I'm getting this error:

ERROR:  missing FROM-clause entry for table "grc_bor"
LINE 3: ST_Intersection(data.agri.geom,data.grc_bor.geom) as geom fr...

What am I missing?


2 Answers 2


@Mapperz Link pointed me to the right direction.

The correct SQL query seems to be :

create table data.agri_grc as select
 ST_Intersection(a.geom,b.geom_3035) as geom from
  data.agri as a, 
  data.grc_bor as b;

you need to put the arguments as table aliases

  • The aliases don't matter. The query in the question only selects from agri table but grc_bor table is missing in the from part.
    – underdark
    Oct 25, 2012 at 5:31

Try to put the entire SELECT clause in (...)

  • It's more elaborate than that. The link @mapperz gave me an answer. I'll update in a bit :)
    – nickves
    Sep 24, 2012 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.