I have two tables, one with points and one with polygons "in a PostgreSQL database". I need to get the attributes from the polygons "status" to the points that fall inside the polygons and the result need to show all points that the point table consists of and not only those that fall inside the polygons. I also only want 1 or 2 attributes from the polygon layer but the point layer should have all attributes *. My goal is to later create a view.
I tried to get this work with an intersect command but the result only shows points that intersect, it doesn't show the other points. Here is the code I tried with
SELECT
pointlayer.*,
polygonlayer.name
FROM
schema_a.pointlayer,
schema_a.polygonlayer
WHERE ST_Intersects(schema_a.pointlayer.geom, polygonlayer.geom);
I attached an image that might explain what I want better then my text. Notice that status in image says null for points outside, but it just a way of me showing you that the attribute should be empty.
