Can some help me with below scenario..
Note: I have asked similar logic few days back. But this is bit different than this.
I have 2 tables
1. Employ table with employ no, country and date(date when he was present in that country).
2. Insider table with employ no, incident number(issues he worked on) and incident_created_date(when that issue was raised).
Now I want to join both the tables and get Country field in Insider table.
Based on Incident_Created_date <= Emp_Start_Date and where ever the dates are missing for that period the country should be previous country
i.e. from above employ table we don't have any details from 12th Jun' 2008 to 13th Jan' 2010.
But we will have data for this period in Insider table and for those records I want country to be US.
Like same for 1st Aug'2007 to 10th Jun'2008 Country = UK
Thanks in Advance..