joining tables. one table has multiple records, one a single record

hello, I have two temporary tables that are created as part of a stored procedure.

both tables have the same structure:

,      [SortGroup]
,      [SortOrder]
,      [Quantity_CurrentYear]
,      [QuantityPriorYear]
,      [VolumeChange]
,      [GrowthPercent]

The first table contains the top 30 customers with highest growth percentage, and the other table contains a single row that shows totals for all the other customers (not top 30)
screen shot
my question is, what type of join would I have to use in this case?

any example would be great.

Thank you very much.
Who is Participating?
x-menConnect With a Mentor IT super heroCommented:

select * from table1
union all
select * from table2
plusone3055Connect With a Mentor Commented:
is your desired result
seeing all 31 rows ?

if so just do a UNION

Select * from table1
Select * from table2
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
.. and to make sure the totals row is on the bottom..

SELECT 0 a sort_order, *
FROM Table1
SELECT 1 as sort_order, *
FROM Table2
ORDER BY sort_order
metropiaAuthor Commented:
thank you very much!
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.

All Courses

From novice to tech pro — start learning today.