Multiple Queries Using a Union - Need to Insert Final Result Set into a Temp Table

I have a query with multiple unions (needed this because of the data inputs).  I now need to insert the entire result set into a temp table...how do I accomplish this?  Thank You

Select a, b, c, from a where a = x
union
Select a, b, c, from a where a = b
union
Select a, b, c, from a where a = c

into #a

select * from a

Glen_DAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ava23Connect With a Mentor Commented:
SELECT * INTO #A FROM
(Select a, b, c, from a where a = x
union
Select a, b, c, from a where a = b
union
Select a, b, c, from a where a = c
)TMP

select * from #A
0
 
Glen_DAuthor Commented:
Here's a better description of the query - actual code:

select b.Categories, a.*
from dbo.tbl_2510v1 a, dbo.tbl_Def b
where (a.FacilityAsset like '%Acoustics Testing%' or
          a.Description like '%Acoustics Testing%' or
          a.Requirement like '%Acoustics Testing%')
and b.categories like '%Acoustics Testing%'
union
select b.Categories, a.*
from dbo.tbl_2510v1 a, dbo.tbl_Def b
where (a.FacilityAsset like '%Avionics%' or
          a.Description like '%Avionics%' or
          a.Requirement like '%Avionics%')
and b.categories like '%Avionics%'
union
etc
etc
etc
0
 
Glen_DAuthor Commented:
Thank You
0
All Courses

From novice to tech pro — start learning today.