Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Complex select
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Complex select
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01132829
Message ID:
01132829
Vues:
60
Hi everybody,

I'm trying to find open accounts that have calculated balance not matching the current balance in the Trans table.

Here is my current select statement:
SELECT Trans.yReferral_balance_amount, Trans.yCurrent_balance_amount, ;
	(SELECT SUM(Payments.yAmount_Paid) as yBalance ;
	FROM Payments inner join Trans Trans1 ;
	on Payments.cTrans_fk = Trans1.cTrans_pk ;
	WHERE Payments.cTrans_fk = Trans.cTrans_pk ;
	and Payments.dPosting_date > Trans1.tDate_received) ;
	as yTotalPayments ;	
   FROM TRANS ;
   WHERE Trans.cResolution_Codes_fk is NULL into cursor curAllBalances nofilter
The Calculated balance equals Referral Balance - All payments after received date.

I'm not sure how can I add this calculation into this SQL. Of course, I can do this in two steps, but is there a way to do in one step?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform