top of page

Book Errata –


I found a mistake in the How do I do that in PostGIS book on page 4.  When updating a field with results from a related table, I incorrectly referred to an inner SELECT statement.  The new text should read:

==============================================================

Calculations on a related table

You can also use a table relation, and update the value in one table with values in another table that are related by a common field.  In this example we are subtracting the land value in the parvalues table from the asmt value in the parcels table.  To accomplish this, we are explicitly stating that we want to UPDATE parcels, but are referencing the parvalues table in the FROM directive:

 UPDATE parcels
 SET homevalue = parcels.asmt - parvalues.land
 FROM parvalues
 WHERE parcels.parcelkey = parvalues.parcelkey

===============================================================

New versions of the book, starting today, will have this correction*

*for those who have wanted to update a table based on another table, this is a useful query – there are more cool things like this in the book, so go out and pick one up today (or two).

0 views0 comments
bottom of page