2016-09-29 52 views
0

使用Amazon redshift使用POSTGRESQL更新某些列。Amazon Redshift不允許在現有表上使用UPDATE + JOIN並且找不到合適的列?

我有兩個表:

Table A         

    A  B  C   D 
0 23as  asd  adf  [NULL] 
1 23as  asd  adf  [NUll] 
2 23as  asd  adf  [NUll] 

Table B         

    A  B  C   D 
0 23as  asd  adf  4234 
1 23as  asd  adf  5454 
2 23as  asd  adf  7867 

我試圖與tableB.D填充tableA.D一個加入,但我得到的錯誤是

"SQL Error [500310] [42703]: [Amazon](500310) Invalid operation: column "d" of relation "tableA" does not exist; 
    [Amazon](500310) Invalid operation: column "d" of relation "tableA" does not exist; 
    com.amazon.support.exceptions.ErrorException: [Amazon](500310) Invalid operation: column "d" of relation "tableA" does not exist; 

這裏是我的更新/加入聲明:

update tableA 
set d= tableB.d 
from tableB 
where 
    tableA.A= tableB.A and 
    tableB.C= 'Completed ' 

我在做什麼錯誤,這個簡單的UPDATE + JOIN不工作,它沒有找到表中的列?

+1

該查詢似乎找到了我。你使用'tableA'中有一列'd'嗎?嘗試'SELECT d FROM tableA LIMIT 1'。它會返回一個錯誤嗎? – redneb

+0

只是運行你的SELECT語句而沒有錯誤 – RustyShackleford

回答

相關問題