Michael,
It depends on the first record that the SQL statement extracts as to the
format of the calculated field.
Either use:
select
sum(iif(SomeCondition,1.00*ValueX,0.00)) as TotalValueX from
curATable
Or use the Cast() command if you use VFP9
Dave Crozier
"A computer is a stupid machine with the ability to do incredibly smart
things, while computer programmers are smart people with the ability to do
incredibly stupid things. They are, in short, a perfect match" - Bill
Bryson
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Michael Hawksworth
Sent: 10 July 2006 14:03
To: Profox
Subject: iif in a sum
I have a select statement with a sum on a field that contains an iif
statement and it looks as though the iif is truncating the value...
&& Example
select
sum(iif(SomeCondition,ValueX,0)) as TotalValueX from
curATable
if ValueX had values of 1.2 and 3.4 the answer would be 4.
But this works...
select
sum(iif(SomeCondition,1,0) * ValueX) as TotalValueX from
curATable
return s 4.6
has anyone seen this before?
--
Michael Hawksworth
Visual Fox Solutions
[EMAIL PROTECTED]
www.foxpro.co.uk
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** 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.