Avatar of splanton
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Combine two unrelates select statements into one set of results (cartesian)

I have a requirement to display the result of two unrelated select statements.

For example:

Query 1:

SELECT Id,Description FROM Site

Id      SiteDesc
1      London
2      Brighton
3      Manchester

Query 2

SELECT Id,Description FROM WasteStream

Id      WasteStreamDesc
1      Cardboard
2      Paper
3      Cans

I need to show the following:

Id      SiteDesc      WasteStreamDesc
1      London      Cardboard
1      London      Paper
1      London      Cans
2      Brighton      Cardboard
2      Brighton      Paper
2      Brighton      Cans
3      Manchester      Cardboard
3      Manchester      Paper
3      Manchester      Cans

This may seem a daft query but it it part of something much bigger and will be used iterativly in a function.

Any help would be appreciated.
Microsoft SQL Server 2008Microsoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon