Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Im trying to run this query :

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

But im 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...

Whats I am missing?

In postgis2 db

share|improve this question
1  
add comment

2 Answers 2

up vote 3 down vote accepted

@Mapperz Link pointed me to the right direction.

The correct SQL query seems to be :

create table data.agri_grc as select
 a.id, 
 a.code_00,
 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

share|improve this answer
    
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 '12 at 5:31
add comment

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

share|improve this answer
    
It's more elaborate than that. The link @mapperz gave me an answer. I'll update in a bit :) –  nickves Sep 24 '12 at 21:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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