VB.net SQL show all of one field in aggregate function

Hi
I am using the following SQL statement to get the total Amount for each company.
The result only shows a few companies. I need ll companies to be returned even if the aggregate is null or zero. How do I achieve this? Should I do an outer join on a select that selects just company or is there an easier methos?

SELECT [Company],Sum(Amount) As Aggregate FROM Table_Pivot)  Group By [Company]
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
you need to start from a table containing all the companies.

select *
from Companies as C
left join (
   SELECT [Company],Sum(Amount) As Aggregate
   FROM Table_Pivot  
   Group By [Company]
) as T
on C.CompanyField = T.Company
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0
All Courses

From novice to tech pro — start learning today.