SQL Server 2008 combining a query.

Frirst: A bit of background...

I have two tables related one to many with a third as a resolving table :

WasteType
WasteTyperesolve (resolving table)
WasteSubtype

They look like this:

WasteType
Id      Description
1      Cardboard
2      Paper
3      Cans
4      General

WasteSubType
Id      Description
1      Cardboard
2      Paper

WasteSubTypeResolve
Id      ParentId      ChildId
1      4       1
2      4      2

The following query combines the two tables, ignoring any WasteType records that have WasteSubtypes:

SELECT [Description] FROM [WasteType]
WHERE [WasteTypeId] NOT IN (SELECT [WasteTypeId] FROM [WasteSubTypeResolve])
UNION SELECT [Description] FROM [WasteSubType] ORDER BY [Description]

It would produce:

Cardboard
Paper
Cans

The question...

I need to combine this query with another one.

The second query is

SELECT Id,Description FROM Site

and returns:
Id      SiteDesc
1      London
2      Brighton
3      Manchester


I need to combine these queries 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

I did post a similar question earlier in the day about combining the results of two tables but that was BEFORE I was informed hat the first query was a little more complicated that I had originally been led to believe.
LVL 2
splantonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel WilsonCommented:
how's this?
SELECT S.ID, S.Description, W.[Description]  FROM [WasteType] W, Site S
WHERE [WasteTypeId] NOT IN (SELECT [WasteTypeId] FROM [WasteSubTypeResolve])
UNION SELECT S.ID, S.Description, W.[Description] FROM [WasteSubType]W, Site S ORDER BY W.[Description]

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
splantonAuthor Commented:
A very clear,concise more importantly working) solution. Many thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.