I have two tables, A and B. I want to write JSL that will find all the rows in A whose ID is represented one or more times in B, and then append those rows to B to yield a new table C.
For example, let this be A:
ID | Data | Day |
1 | Red | Sun |
2 | Orange | Mon |
2 | Yellow | Tue |
3 | Blue | Wed |
4 | Indigo | Thu |
4 | Violet | Fri |
4 | Fuchsia | Sat |
5 | Teal | Sun |
6 | Black | Mon |
And let this be B:
ID | Data | Day |
6 | Aqua | Tue |
1 | Pink | Wed |
1 | Beige | Thu |
4 | White | Fri |
9 | Gold | Sat |
10 | Silver | Sun |
I want code to generate a table C that looks like this (row order doesn't matter):
ID | Data | Day |
6 | Aqua | Tue |
1 | Pink | Wed |
1 | Beige | Thu |
4 | White | Fri |
9 | Gold | Sat |
10 | Silver | Sun |
1 | Red | Sun |
4 | Indigo | Thu |
4 | Violet | Fri |
4 | Fuchsia | Sat |
6 | Black | Mon |
This seems simple, but I've confused myself as to the best way to do it. The method should scale well with respect to speed and memory for A and B tables of >1 million rows.