Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT-SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
SELECT-SQL
Divers
Thread ID:
00500998
Message ID:
00500998
Vues:
37
I have some code that looks like this:
SELECT collections1.bankname, collections1.portfolio, collections1.companyid ,;
	SUM(IIF(NOT EMPTY(collections1.settdate), 1, 0)) AS tot_col, ;
	SUM(IIF(INLIST(trancode, '21', '22', '31', '32'), collections1.amount, 0000000000.00)) AS nCredit, ;
	SUM(IIF(INLIST(trancode, '21', '22', '31', '32'), 1, 0)) AS nCreditnum, ;
	SUM(IIF(INLIST(trancode, '26', '27', '36'), collections1.amount, 0000000000.00)) AS nDebit, ;
	SUM(IIF(INLIST(trancode, '26', '27', '36'), 1, 0)) AS nDebit_num ;
	FROM collections1 ;
	WHERE collections1.portfolio = cBank ;
	GROUP BY collections1.companyid ;
	INTO TABLE c:\dis_collections

*COPY TO mis_collections TYPE XL5
USE IN dis_collections
USE IN collections1


SELECT dis_collections.*, companyid.bankname AS bank, companyid.companyid AS newid ;
	FROM FORCE dis_collections LEFT OUTER JOIN \\Svrpc-stlmnt01\e\RETURN-Items\DATA\companyid ;
	ON ALLTRIM(dis_collections.companyid) == ALLTRIM(companyid.companyid) ;
	ORDER BY dis_collections.bankname  ;
	INTO TABLE dis_collections1

USE IN dis_collections
USE IN dis_collections1
USE IN companyid

USE dis_collections1 IN 0
SELECT dis_collections1
SCAN

	REPLACE bank WITH bankname FOR ISNULL(bank)
	REPLACE bank WITH "KEY" FOR bankname = "KEY"
	REPLACE bank WITH "UMB" FOR bankname = "UMB"
	REPLACE bank WITH "ZIONS" FOR bankname = "ZIONS"

ENDSCAN
GO TOP
COPY TO c:\dis_collections1 TYPE XL5
USE IN dis_collections1
I need to do this for 4 other tables. I will then combine them into on table. IS there an easy way to get all this information in one SELECT and combine them later?

Thanks in advance for your help!
Thanks in advance for your help! :-)
Randall L. Johnson
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform