我在Postgres 9.6服务器上有两个数据库:
-GEO_DATA has table: DIR_SURVEY
-COUNTY_DATA has view: QA_TVD_CHECK
两个对象都有一个共同的字段:FN(字符变化)。
我想从DIR_SURVEY中删除FN与视图QA_TVD_CHECK输出的FN列表匹配的那些记录。我遇到语法问题。
我已经在GEO_DATA中成功创建了一个dblink()以便能够访问COUNTY_DATA。
此查询有效:
Select FN from dblink('county_data', 'Select FN from QA_TVD_CHECK where abs(delta) <= 100') AS DATA(FN CHARACTER VARYING);
此查询不:
Delete from DIR_SURVEY where FN in dblink('county_data', 'Select FN from QA_TVD_CHECK where abs(delta) <= 100') AS DATA(FN CHARACTER VARYING);
如何解决查询,使其有效?我得到的错误是:
ERROR: syntax error at or near "dblink"
LINE 1: Delete from DIR_SURVEY where FN in dblink('county_data', 'Se...
^
SQL state: 42601
Character: 36