Skip to content
Advertisement

How can I achieve a Cartesian Product for all distinct entries of two fields within the provided sample data without using a Cross Join (MySQL 5.6)? [closed]

Here’s a sample data set:

Specifically, I want to get the Cartesian Product of the ‘Material’ and ‘Type’ fields.

Advertisement

Answer

You can use a regular join:

Seems like a strange request. cross join is the built-in functionality for this purpose. I should note that the on clause is optional in MySQL, but I strongly recommend using it with join.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement