select from one table with help of another table

From: <paul(dot)malm(at)lfv(dot)se>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: select from one table with help of another table
Date: 2020-06-16 08:37:54
Message-ID: 83202aff46a942fd922fdb7457442b37@lfv.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi, list,
I'm trying to get the fid (integer) of objects in table line where the geometry (postgis) is inside another geometry from another table (polygon),
But I would not like to get the objects with the highest fid inside the polygons of table buffered.
I've tried this:
SELECT fid FROM
"line" USING "polugon" AS b WHERE
ST_Contains(b.geom, "line".geom) AND "line".fid NOT IN (SELECT MAX("line".fid)
);

It complains about "USING" in line 2.
Anyone who knows how I should do it instead?
Kind regards,
Paul

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Laurenz Albe 2020-06-16 12:03:33 Re: select from one table with help of another table
Previous Message Manojkumar S 2020-06-15 11:05:11 ".partial" WAL file missing while promoting database in streaming replication.