[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2014-02-19
2
Medium Priority
?
205 Views
Last Modified: 2014-02-19
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]
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 39869914
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
 

Author Closing Comment

by:Murray Brown
ID: 39869915
Thanks very much
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question