Bill, Your solution works as well (did I expect anything else).
Jan -----Original Message----- From: Bill Downall <[email protected]> To: [email protected] (RBASE-L Mailing List) Date: Mon, 7 Dec 2009 15:13:13 -0500 Subject: [RBASE-L] - Re: SELECT DISTINCT - Resolved Wonderful! I was assuming that you had a many-to-many relationship, a CustPO could be used on multiple WOBillIDs, and that one WOBillIDs could map to multiple CustPOs, and that's why it was so complicated. Bill On Mon, Dec 7, 2009 at 3:07 PM, jan johansen <[email protected]> wrote: Bill, I just had to step back and look at this again. The DISTINCTness is really at the CustPO level. So SELECT COUNT(DISTINCT CustPO) INTO vCountWOBILLID FROM Invoiceing WHERE Status = 'D' AND BillingType = 'G' provides the correct answer. Thanks for giving me some ideas. Jan

