I have a table with integer columns and I wanted to calculate to some simple statistics. To make the calculations more portable, I chose to use SQL rather than the XBase calculate command. This is an example of what I tried:
SELECT AVG(myintcolumn) FROM myTable INTO ARRAY myArray Result 0. I knew that the average would be small but it should not have been zero. I tried the equivalent calculation using CALCULATE AVG() and got the correct answer (0.7). I then changed the SQL to: SELECT CAST(AVG(myintcolumn) As B(1)) FROM myTable INTO ARRAY myArray Bingo! Result 0.7. The mistake I made was in thinking that SQL and XBase calculations are identical - they're not. SQL preserves the underlying data type and CALCULATE returns a numeric. Moral: NEVER ASSUME ANYTHING. Laurie --- 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.

