Jan, doesn't SELECT COUNT(DISTINCT(WOBILLID,CustPO)) WORK? ie: the columns in 
brackets for the distinct and then for the count.

Regards,
Alastair.

  From: jan johansen 
  Sent: Monday, December 07, 2009 6:02 PM
  To: RBASE-L Mailing List 
  Subject: [RBASE-L] - Re: SELECT DISTINCT


  Ok,

  This is just to weird. Trust me when I say that there is a column there
  but I am typing it in now instead of pasting.

  SELECT COUNT(DISTINCT WOBILLID) INTO vCountWOBILLID FROM Invoiceing +
     WHERE Status = 'D' AND BillingType = 'G'

  If I change it to 
  SELECT COUNT(DISTINCT WOBILLID,CustPO) INTO vCountWOBILLID FROM Invoiceing +
     WHERE Status = 'D' AND BillingType = 'G'
  it throws an error.

  So it looks like a 2 column DISTINCT works in a CURSOR but not for COUNT
  which is probably normal since COUNT is an aggregate function.

  So I am still looking for a way to count the unique values in rows based on 2 
columns.

  Jan

   

   
    -----Original Message-----
    From: "jan johansen" <[email protected]>
    To: [email protected] (RBASE-L Mailing List)
    Date: Mon, 07 Dec 2009 09:51:36 -0800
    Subject: [RBASE-L] - Re: SELECT DISTINCT


    Bill, 

    You are absolutely right!
    That was weird. I just copied the command and
    the column(s) disappeared.

    Here they are again

    SELECT
    (DISTINCT ) INTO vCountWOBILLID FROM Invoiceing +
    WHERE Status = 'D' AND BillingType = 'G'
    DECLARE Invoice CURSOR FOR SELECT +
    DISTINCT WOBILLID , CustPO FROM Invoiceing + 
    WHERE Status = 'D' AND BillingType = 'G' COUNT WOBILLID



    So if I change count to   
    SELECT COUNT(DISTINCT ) INTO vCountWOBILLID FROM Invoiceing +
    WHERE Status = 'D' AND BillingType 'G'it throws an error



    WOBILLID,CustPO
    Jan 


     
      -----Original Message-----
      From: Bill Downall <[email protected]>
      To: [email protected] (RBASE-L Mailing List)
      Date: Mon, 7 Dec 2009 12:43:17 -0500
      Subject: [RBASE-L] - Re: SELECT DISTINCT

      Jan, 

       
      DISTINCT needs a column name after it.

       
      Bill


      On Mon, Dec 7, 2009 at 12:39 PM, jan johansen < [email protected]> 
wrote:

        Group,

        This morning as I was troubleshooting a process for generating 
invoices, I ran into challenge

        I have a cursor that works fine and generated 39 invoices. The problem 
was that my method
        to determine how many invoices would print calculated 33 invoices. 
While a minor issue, I
        need a better to count.

        My cursor has the following;
        DECLARE
        +
        DISTINCT WOBILLID , CustPO FROM Invoiceing + 
        WHERE Status = 'D' AND BillingType = 'G' Invoice CURSOR FOR SELECT

        My calculation has;
        SELECT
        (DISTINCT ) INTO vCountWOBILLID FROM Invoiceing +
        WHERE Status = 'D' AND BillingType = 'G'   COUNT WOBILLID
        I know, I know. They are different. However when I tried to change my 
SELECT to



        SELECT COUNT(DISTINCT ) INTO vCountWOBILLID FROM Invoiceing +
        WHERE Status = 'D' AND BillingType = 'G'
        WOBILLID,CustPO
        I get an error. 


        My suspicion is that the aggregate COUNT doesn't like it. I just found 
it interesting that I could declare a
        distinct cursor on 2 columns but not count distinct on 2 columns.

        The reason for the distinct is that a customer could send several 
different po's during a billing cycle
        Also the possibility exists that 2 different customers could use the 
same PO.

        Any suggestions are appreciated.

        Jan



          -----Original Message-----
          From: Lawrence Lustig <[email protected]>
          To: [email protected] (RBASE-L Mailing List)
          Date: Mon, 7 Dec 2009 09:22:30 -0800 (PST)
          Subject: [RBASE-L] - Re: 7.6 Entry/Edit form


          <<
          I do not want the user to be able to add additional rows when in EDIT 
mode.
          >>

          Try (in the AFTER START EEP):

          IF RBTI_FORM_MODE = 'EDIT' THEN
            PROPERTY TABLE YourTableName 'DISABLE_ADD_NEW_ROWS'
          ENDIF

          --
          Larry


           


       



------------------------------------------------------------------------------



  No virus found in this incoming message.
  Checked by AVG - www.avg.com 
  Version: 9.0.709 / Virus Database: 270.14.97/2550 - Release Date: 12/07/09 
07:33:00

Reply via email to