Skip to content
Advertisement

Connecting two queries to get Cartesian product

I have a query

if #ID# = 1 it returns table

if #ID# = 2 it returns table

Now I want merge these two tables/queries to get a table which looks like that:

So basically it is a table of the Cartesian product of the rows with the same GUID

Advertisement

Answer

You don’t need subqueries:

I think this is more readable using CTEs:

In both these examples (and what is implied by your question) GUIDs with only one word are filtered out. These can be included by tweaking the queries.

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