Sytze de Boer wrote:
> Can someone help me with this please
> I have a table with lots of entries, and trantype either D or P
> All values of ttlvalue are positive
>
> I perform this
> SELECT IIF(trantype='D',SUM(ttlvalue),SUM(ttlvalue)*-1) FROM MYTABLE INTO
> CURSOR P3
>
> It gives me the grand total of all transactions, regardless.
> What I need is D(eposits)  less P(ayments)
>
>
>   

Well, I'm betting there's a better way to do this, but right off the 
bat, I'd do:

Select Sum( IIF(trantype='D', ttlvalue, ttlvalue*-1)) as balance .... 
etc.etc.



_______________________________________________
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
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