[AccessD] SQL count distinct problem

Hale, Jim Jim.Hale at FleetPride.com
Wed Mar 8 10:18:44 CST 2006


Thank you. That was the sub query I was looking for.
Jim Hale


-----Original Message-----
From: Scott Marcus [mailto:marcus at tsstech.com]
Sent: Wednesday, March 08, 2006 7:08 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] SQL count distinct problem


SELECT W.vendor,
      (SELECT count(C) As Checks
       FROM (SELECT V.vendor,
                    V.checkno AS C
             FROM VendorChecks V
             GROUP BY V.vendor, V.checkno)
       WHERE V.vendor=W.vendor) AS NumOfChecks,
       Sum(W.amt) AS SumOfamt
FROM VendorChecks AS W
GROUP BY W.vendor;

Slightly more complicated, but another way of doing the query.

Scott Marcus


***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list