counting values in an update statement postgres

المشرف العام

Administrator
طاقم الإدارة
I have a repetitive method I want to execute and I expected underneath script to work. I found out the count() function is not allowed in postgres update statements. What is the most logical and simple way to update my column with the count of occurences I encounter, without creating a new table.

UPDATE table1 as tbl1 SET new_column = count(tbl2.*) FROM table2 as tbl2 WHERE ST_Intersects(tbl1.geom, tbl2.geopunt)

أكثر...
 
أعلى