Thank you all.

I awkwardly solved the problem in FPW2.6a with a SCANALL

The original table:

   Structure for table:    gluctmp1.dbf
   Number of data records: 4209
   Date of last update:    03/01/2002
   Code Page:               0
   Field  Field Name  Type       Width    Dec    Index Collate
        1  DATE        Date           8
        2  TIME        Character      8
        3  CATEGORY    Character     10
        4  MEAL        Character     12
        5  AMOUNT      Numeric        3
        6  NOTES       Character     40
   ** Total **                      82

To start toget the total count for glucose testing in rolling 21 day periods -- rows:

   SELECT ;
        Gluctmp1.date AS Sdate, ;
        COUNT(Gluctmp1.date) AS Cnt_Day, ;
        0000 AS Cnt_21 ;
   FROM Gluctmp1;
   WHERE ;
        Gluctmp1.category = "Glucos";
         GROUP BY Gluctmp1.date ;
   INTO TABLE Cnt_Stri.dbf

   M_Recno = 1

   SCAN ALL

        GOTO M_Recno

        SUM Cnt_stri.cnt_day ;
            NEXT 21;
            WHILE NOT EOF() ;
            TO SUM_21

        REPLACE Cnt_Stri.CNT_21 WITH SUM_21

        IF EOF()
            EXIT
        ENDIF

        M_Recno = M_Recno + 1

        GOTO M_Recno

        LOOP
   ENDSCAN

   BROWSE

The resulting TABLE -- first 25 rows:

   Record#  SDATE         CNT_DAY CNT_21
          1  01/08/2001          1      0
          2  01/09/2001          2      0
          3  01/10/2001          4      0
          4  01/11/2001          3      0
          5  01/12/2001          2      0
          6  01/13/2001          4      0
          7  01/14/2001          5      0
          8  01/15/2001          5      0
          9  01/16/2001          4      0
         10  01/17/2001          4      0
         11  01/18/2001          4      0
         12  01/19/2001          4      0
         13  01/20/2001          2      0
         14  01/21/2001          4      0
         15  01/22/2001          5      0
         16  01/23/2001          5      0
         17  01/24/2001          4      0
         18  01/25/2001          6      0
         19  01/26/2001          6      0
         20  01/27/2001          6      0
         21  01/28/2001          5     85
         22  01/29/2001          6     90
         23  01/30/2001          6     94
         24  01/31/2001          5     95
         25  02/01/2001          4     96

-- *Charles* --
Website: http://homepages.uc.edu/~enzerch/ <http://homepages.uc.edu/%7Eenzerch/>
*"Medicine is a science of uncertainty and an art of probability"
*William Osler, M.D.

***Stop **Spammers**and **Virus Propagation***

***Before **forwarding**, please **delete**the history of all email address***

On 5/1/2013 3:23 PM, Charles Hart Enzer, M.D., FAACP wrote:
I want to:

   SELECT ;
        dates, ;
   COUNT (amount) as CNT ;
        FROM data ;
        WHERE dates = BETWEEN(dates, dates, dates + 20) = .T. ;
   GROUP BY 1 ;
        ORDER BY 1

I also tried instead of the WHERE clause:

     HAVING BETWEEN(dates,dates,dates + 20 ) = .T.

Each "dates" has a number of "amount" records.

I want to make a count of the number of records for every 21 day range.

Thank you.



--- StripMime Report -- processed MIME parts ---
multipart/alternative
 text/plain (text body -- kept)
 text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to