Joining two tables based on datesHi,
I want to accomplish something which I think is very simple: Joining tables based on dates.
Let's say I have the following tables:
Table1 - which has the following columns: Group1, event_date.
Table2 - which has the following columns: Group2, start_date, end_date.
I want the join to work as follows: (Group1 == Group2) AND (start_date < date < end_date)
How can I accomplish this using a JSL code?
Thanks
Data TableRe: Joining two tables based on datesI think it will be easiest to Query for this and write some SQL for the join
Names Default To Here(1);
// Using aliases, performing a join
dtSAT = Open("$SAMPLE_DATA/SATByYear.jmp", Invisible);
dtUS = Open("$SAMPLE_DATA/US Demographics.jmp", Invisible);
Query(
Table(dtSAT, "t1"),
Table(dtUS, "t2"),
"\[SELECT t1.State, t1."SAT Math", t2."College Degrees",
t2."Eighth Grade Math"
FROM t1
LEFT OUTER JOIN t2
ON t1.State = t2.State
WHERE t1.'SAT Math' > 550;
]\"
);
It isn't the only option but it should be fairly simple and easy to understand (if you know SQL).
Re: Joining two tables based on datesPerfect! I didn't know you can work with SQL syntax within JMP. This will make my life a lot easier from now on.
Thank you