Group by Count

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I set the COunt to return ZERO when there is no item to count instead
of returning NO Value...

I Need Help ASAP.
 
You can't, at least not in a query. There has to be something there to
generate the row in the query.

However, if for example you wanted to have a list of all customers and their
total sales, whether or not they've bought something, you can use:

SELECT Customers.CustomerName, Nz(Sum(SalesAmount), 0) As TotalSales
FROM Customers LEFT JOIN Sales
ON Customers.CustomerID = Sales.CustomerID

Using a LEFT JOIN means that there will be one row for each entry in
Customers, whether or not there are matching rows in Sales.
 
Back
Top