[GRASS-user] Associating attributes from Postgres file with a key other than cat

Jarek Jasiewicz jarekj at amu.edu.pl
Thu Aug 9 11:55:22 EDT 2007


Turner, James wrote:
> That would work if there was an equivalent to the CAT field in the table
> I wanted to join to.  There isn't, it needs to join on the zip code,
> which is the key field for the data in Postgres.  There doesn't seem to
> be any way to associate data from an SQL table to a piece of vector data
> unless the SQL table has the same cat field available.  In other words,
> if the original imported e00 file has:
>
> cat
> zipcode
> altitude
> population
>
> and the database table has:
>
> zipcode
> median_income
> life_expectancy
>
>   

I have a problem with understanding what you really want, because I see 
no relation between imported e00 and database (there are from one source 
or not, I don't know if database of e00 is in pgSQL or in other pale 
etc) but, if you have in one database two tables: let say: e00 and ZTCS 
with structure similar to above mayby this will help:

CREATE TABLE joined AS
SELECT e.cat AS cat, e.zipcode AS zipcode, e.population AS population 
z.medianincome AS medianincome, z.life_xepectancy AS life_expentancy 
FROM ZTCS z JOIN e00 e ON z.zipcode=e.zipcode;

next join jour importet e00 file to new table with v.db.conect





More information about the grass-user mailing list