We have three tables here, Session table which is connected to Green_fact table with Session_id field. Time_session table is the third table which is made of SessionDate from Session table with a primary key for every single day.
How can I populate the Date_ID field in Green_fact table. the code below is what I think use, but it doesn't work properly
update green_fact
inner join "SESSION" on green_fact."SESSION_ID" = "SESSION"."SessionID"
inner join "TIME_SESSION" on "TIME_SESSION"."SESSION_DATE" = "SESSION"."SessionDate"
set green_fact."DATE_ID" = "TIME_SESSION"."ID" where green_fact."SESSION_ID" = "SESSION"."SessionID";