a = {a1, a2, a3}; b = {b1, b2, b3, b4}; Join[Tuples[{a, b}], Tuples[{b, a}]]
Given the operation of choosing one element respectively from sets a and b to carry out permutation, what other solution methods are available?
And
Join[Flatten[Outer[List, a, b], 1], Flatten[Outer[List, b, a], 1]]
;-)
Catenate[Tuples /@ Permutations[{a, b}]] Flatten[Table[Permutations[{i, j}], {i, a}, {j, b}], 2]