skip to Main Content

I’m updating table_A with a variable, new_var, pulled in from table_B.

Both table_A and table_B are in the same schema.

alter table schema.table_A add column new_var varchar(3)

update schema.table_A
set schema.table_A.new_var = schema.table_B.new_var 
from schema.table_B where schema.table_A.record_id = schema.table_B.record_id

However, Redshift doesn’t recognize the "schema"."table"."field" syntax format.

How do you identify variables from a specific schema and table?

2

Answers


  1. Redshift does recognize the "schema"."table"."field" syntax format.
    You don’t have to specify the table and schema for schema.table_A.new_var
    It is implied that the column you are updating (new_var) is a column of schema.table_A

    Login or Signup to reply.
  2. You will have to use something like this if you are updating table_A from table_B in redshift.

    update schema.table_A
    set new_var = schema.table_B.new_var
    from schema.table_B
    where schema.table_A.record_id = schema.table_B.record_id
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search