Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combining subquery results 1

Status
Not open for further replies.

amy88

IS-IT--Management
Dec 22, 2003
34
MX
I am writing a query and want to combine two subqueries in an unusual way.

Is there any way to combine the contents of subqueries and so that you have the complete data sets from each subqry in independent rows... add the rows from subqry 2 to subqry 1 (rather than adding columns from subqry 2 to subqry 1).

This is driving me crazy. Really appreciate any advice.
 
It's hard to say without seeing your code, but I would encourage you to do a little research on the "Union" and "Union All" operators.

Union will filter out distinct rows so it is a little slower than Union All that does not filter out distinct rows.



-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Thanks... will check into it immediately and post what I find out.
 
Awesome, simple for you, but I never used it. UNION ALL was exactly what I needed!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top