WillieLoMain
Technical User
I am looking to run some simple code against 2 Tables.
The net result is to be a SUM of 3 columns in the 2 Tables and a 4th value wich is an addition/subtraction of the first 3.
The existing code in my app is slow. It is much fatser as I have written below but my lack of programming (which is vast) skill is giving me some trouble.
My problem is that the expression in [[[Brackets]]] below does not seem to be doing what I had hoped.
The code follows
SELECT SUM(Payment.pay), SUM(Payment.adj);
FROM Payment;
into cursor Pay
SELECT SUM(Visits.vcharge);
FROM Visits;
into cursor Vis
[[[SUM(Vis.sum_vcharge - Payment.pay - Payment.adj) TO AR]]]
SELECT SUM_pay, SUM_adj, SUM_Vcharge, AR;
FROM Pay, Vis;
to screen
In the end I get as AR the same value as SUM(Visits.vcharge)
I assume my syntax is all wrong but have no clue how to fix it.
What I realy wanted to do was make the calculation and place the value in Cursor AR.
I tried that like this:
SUM(Vis.sum_vcharge - Payment.pay - Payment.adj)
INTO Cursor AR
But that seems even more wrong and I assume there is no way to get the result of the expression Into the Cursor.
Any and all suggestions appreciated
Thanx in advance
The net result is to be a SUM of 3 columns in the 2 Tables and a 4th value wich is an addition/subtraction of the first 3.
The existing code in my app is slow. It is much fatser as I have written below but my lack of programming (which is vast) skill is giving me some trouble.
My problem is that the expression in [[[Brackets]]] below does not seem to be doing what I had hoped.
The code follows
SELECT SUM(Payment.pay), SUM(Payment.adj);
FROM Payment;
into cursor Pay
SELECT SUM(Visits.vcharge);
FROM Visits;
into cursor Vis
[[[SUM(Vis.sum_vcharge - Payment.pay - Payment.adj) TO AR]]]
SELECT SUM_pay, SUM_adj, SUM_Vcharge, AR;
FROM Pay, Vis;
to screen
In the end I get as AR the same value as SUM(Visits.vcharge)
I assume my syntax is all wrong but have no clue how to fix it.
What I realy wanted to do was make the calculation and place the value in Cursor AR.
I tried that like this:
SUM(Vis.sum_vcharge - Payment.pay - Payment.adj)
INTO Cursor AR
But that seems even more wrong and I assume there is no way to get the result of the expression Into the Cursor.
Any and all suggestions appreciated
Thanx in advance