For a sort-merge join, there are three steps, since the inputs to the sort-merge joins are both sorted worktables:
A table or set of tables is scanned and the results are inserted into one worktable. This will be the outer table in the merge.
Another table is scanned and the results are inserted into another worktable. This will be the inner table in the merge.
Each of the worktables is sorted, then the two sorted result sets are merged.