I have a table LOADING_ZONE
with columns
aid, a_name, addrid, addr1, addr2, city, pstate, country, postalcd, contactnumber, attendancekey,
attendancedate, attendedyesno
and another table STAGE_TABLE
with columns
aid, a_name, addrid, addr1, addr2, city, pstate, country, postalcd, contactnumber, attendancekey,
attendancedate, attendedyesno,action_indicator
I have inserted the data from loading_zone into stage_table using:
INSERT INTO stage_table(aid, a_name, addrid, addr1, addr2, city, pstate, country, postalcd,
contactnumber, attendancekey, attendancedate, attendedyesno)
SELECT aid, a_name, addrid, addr1, addr2, city, pstate, country, postalcd, contactnumber, attendancekey, attendancedate, attendedyesno
FROM loading_zone
and I want to make action_indicator as 'U' when there exists same aid in both tables else 'I'
I tried this but receiving an error:
assign= "update stage_table set action_indicator = (CASE when loading_zone.aid=stage_table.aid then 'U' else 'I' end)"
The error is:
psycopg2.errors.UndefinedTable: missing FROM-clause entry for table "loading_zone"
LINE 1: ...ate stage_table set action_indicator = (CASE when loading_zone...