caught by the 0000000.00 thing! the select * was just lazyness on my part but i have engine behav set at 70.
~M
>First,
>In VFP 8 and later you should put ALL the fields which are not involved in aggregate functions in GROUP BY clause. That is SELECT * is not good. Are you sure you need ALL fields?
>Also: The first record from that quesry defines the field length, so IIF(...,..., 0) must be:
>sum(IIF(stage="70",desqty,00000000000.00)) && make these zeroes to match the length you need.
>In VFP9 you could use CAST() function:
>
>sum(IIF(stage="70", desqty, CAST(0 as N(14,2)))
>
Go raibh maith agat
~M