Clear Filters
Clear Filters

inner join with a conditional statement

1 view (last 30 days)
wesso Dadoyan
wesso Dadoyan on 4 Oct 2017
Edited: Walter Roberson on 4 Oct 2017
Hi,
I have an id that could pertain to two different companies depending on the date of the observation. For example id=1 could pertain to firm A between 1990 and 2000 and pertain to firm B between 2001 and 2016. Usually I can run a simple code to link two tables based on id:
Data=innerjoin(Data1,Data2, 'Keys', {'id'});
if id is unique to each firm. But since id is not unique , how can i modify the codes to include a conditional statement about dates. For instance i want to say the following:
Data=innerjoin(Data1,Data2, 'Keys', {'id'});
where the id selected is the one where the date column in Data1 table (Date0) falls between Dates1 and Dates2 columns in table Data2

Answers (0)

Categories

Find more on Financial Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!