select count(DISTINCT CID) into vMyCIDCount from ARTRANS where INVOICE# = 
.vINVOICE#

Dennis McGrath

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Gray, Damon
Sent: Wednesday, April 01, 2009 3:52 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - There should never be more than one, but...

I'm trying to get a count of customer IDs (CID) tied to an invoice number.  
There should never be more than one CID per invoice, but these can appear 
multiple times in the table as customers pay on an invoice and payment entries 
are made.  For example, there are three payments by Client  105 on Invoice 
137295.  So, I want to run a query to get that count, but the first below is 
giving me a value of 3, and the 2nd lame attempt doesn't give me anything but 
an error.  How should the syntax read for this?

select count(CID) into vMyCIDCount from ARTRANS where INVOICE# = .vINVOICE#     
 (Gives me 3)

select count(select distinct CID from ARTRANS where INVOICE# = .vINVOICE#) into 
vMyCIDCount      (Blows chunks)


               wwwww

               (   @  @   )

-------oOO---(_)---OOo-------

                Damon J. Gray

Anvil Corporation Business Services

                   (360) 937-0770

          oooo0  0oooo

          (        )   (        )

----------\    (----)     /-----------

               \__)   (__/

Reply via email to