On Wed, May 1, 2013 at 4:25 PM, Charles Hart Enzer, M.D., FAACP < [email protected]> wrote:
> Dear Ted: > > Thank you for replying. > > I am trying to get aTable of "amount"s over a 21 day period. > > I think that the problem is theEnddate: > Gluctmp1.date + 20 > > Even though [Gluctmp1.date + 20] is a valid date, SELECT > > I get the [unrecognized command] error with this: > > SELECT Gluctmp1.date, COUNT(Gluctmp1.amount); > FROM Gluctmp1; > WHERE ; > Gluctmp1.category = "Glucos"; > Gluctmp1.date BETWEEN Gluctmp1.date AND (Gluctmp1.date + 20) ; > GROUP BY Gluctmp1.date > > -- Charles -- > Charles: This is far easier to calculate with Xbase procedural logic than with SQL, expecially in FPW 2.6, which had a more limited subset of SQL. Roughly, what I would do would look like this: dStartDate = DATE(2010,1,1) && adjust as needed dEndDate = DATE(2012,12,31) && ditto CREATE Cursor Results (dStartRange D, dEndRange D, nCount N(4,0)); DO WHILE dStartDate < dEndDate SELECT Count(*) as nCount from Gluctmp1 WHERE date between dStartDate and (dStartDate+20) INTO CURSOR OneRow INSERT INTO Results VALUES (dStartDate, dStartDate+20, OneRow.nCount) USE IN OneRow dStartDate = dStartDate + 1 ENDDO --- 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/CACW6n4tVD0ioPDc38m7Qhpaphez6+OFx=fEAd5Zo8A=wla4...@mail.gmail.com ** 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.

