-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here's one way. Say you have a Products table and a Sales & you want to
find out the sales for all products in a month. I'd make a query like
this:
SELECT Product, Sum(SalesAmount) As Sales
FROM (
SELECT DISTINCT ProductID As Product, 0 As SalesAmount
FROM Products
UNION ALL
SELECT ProductID, SalesAmount
FROM Sales
WHERE SalesDate BETWEEN #1/1/2006# AND #1/31/2006#
) As A
GROUP BY Product
The SELECT on the Products table would get all products. The SELECT on
the Sales table would get all sales in Jan 2006. The top SELECT rolls
up all the Products and sales amounts into one line. Any products that
didn't have any sales in Jan 2006 will have a zero value in SalesAmount.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQ+KAmIechKqOuFEgEQJFZwCgndoXmMGxUaqNDWkvQfcsYhWB9n8An2xG
iKrCcMSTRPn5Y/YTeQVJrQYe
=Htdf
-----END PGP SIGNATURE-----