Share via


CROSSJOIN Function

Consider CROSSJOIN(S1, S2**)**. This can be expanded as follows:

  • Make a table out of the sets S1 and S2.

  • If a set is literal (that is, its members are explicitly enumerated), make this table as shown in the section Literal Sets.

  • If a set is the result of an expression, look at the section dealing with that expression to see how to get the table.

The following query performs the CROSSJOIN operation:

SELECT S1.*\Rank, S2.*\Rank, Newrank AS Rank
FROM (SELECT S1.*\Rank, S2.*\Rank FROM S1, S2)
RANK ROWS AS NewRank RANKORDER BY Rank1, Rank2

The notation "S1.*\Rank" means "[All] columns of S1, minus the Rank column."