Postgres INSERT from Source (2 columns) into Target (3 columns)

33 views Asked by At

I am using workbench to create my tables in redshift.My source table dw_subscription has two columns and target testschema.subscription has three columns. This is the piece of code

INSERT INTO testschema.Subscription (subscriptionrowdate, customerid, subscriptionid) SELECT top 100 customerid, subscriptionid FROM dw_subscription;

I want to do insert some values into the subscriptionrowdate (target table) but since source table doesnt have this column, how do go on about assigning a value to the column subscriptionrowdate from SOURCE script?

e.g SOURCE TABLE

SELECT top 100 if subscriptionid is null then subscriptionrowdate =subscriptionid +1, customerid, subscriptionid FROM dw_subscription;

Any ideas? Any help will be appreciated.

0

There are 0 answers