Search Postgresql Archives

Populate Table From Two Other Tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  I want to combine columns in two tables and use the exported resulting
table for statistical analyses. The SQL script is:

INSERT INTO waterchem (site, sampdate, param, quant, ceneq1, low, high,
   stream, basin)
   SELECT c.site, c.sampdate, c.param, c.quant, c.ceneq1, c.low, c.high,
     s.stream, s.basin
   FROM chemistry as c, sites as s
     WHERE c.site == s.siteid;

  The problem is that both c.site and s.siteid are of type VARCHAR(16) and
postgres tells me,

ERROR:  operator does not exist: character varying == character varying

and provides the hint to add explicit type casts. Since the string length of
site/siteid varies I don't see how to cast both to a working type.

  Please suggest how I can populate this table while avoiding the operator
error.

Rich



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux