G
Guest
I have 2 make-table queries:
qry_initial(a) makes a table called tbl_masterpop_new:
SELECT tbl_MasterPop_new.[Loan Acct #], tbl_MasterPop_new.PopEnterDt,
tbl_MasterPop_new.Status, "x" AS prevsta, tbl_MasterPop_new.[Buying Center
#], tbl_MasterPop_new.[Division Name], tbl_MasterPop_new.[Region Name],
tbl_MasterPop_new.[Group Name], tbl_MasterPop_new.[Collection Center Name] AS
Expr1, tbl_MasterPop_new.[Distribution Channel], tbl_MasterPop_new.[New
Institution Name], tbl_MasterPop_new.[Origination Channel],
tbl_MasterPop_new.[Sub Channel], tbl_MasterPop_new.[Short Name],
tbl_MasterPop_new.[Loan Status], tbl_MasterPop_new.[Contract Date],
tbl_MasterPop_new.[Mat date], tbl_MasterPop_new.[Next Pmt Due Date],
tbl_MasterPop_new.[Payoff Date], tbl_MasterPop_new.[Paid Off?],
tbl_MasterPop_new.[Nbr of Reg Pmts Made], tbl_MasterPop_new.[# Reg Pmts
Remaining], tbl_MasterPop_new.[Pmt Scd Monthly Pmt Amt],
tbl_MasterPop_new.[Last Pmt Date], tbl_MasterPop_new.[Last Pmt Amt],
tbl_MasterPop_new.[Amended?], tbl_MasterPop_new.[Amended This Mo?],
tbl_MasterPop_new.[DEL Group], tbl_MasterPop_new.[Days Delinquent],
tbl_MasterPop_new.[Tot Past Due Pmts $], tbl_MasterPop_new.[Principal
Balance], tbl_MasterPop_new.[Val Reserve Dollar Amt],
tbl_MasterPop_new.NETBAL, tbl_MasterPop_new.[Ext?],
tbl_MasterPop_new.[Extended This Mo?], tbl_MasterPop_new.[Payoff Dollar Amt],
tbl_MasterPop_new.[Flat Void Mth of Orig], tbl_MasterPop_new.[Active BK Flag
Date], tbl_MasterPop_new.[Active BK Flag], tbl_MasterPop_new.[Inventory
Status], tbl_MasterPop_new.[Charge Off Principal], tbl_MasterPop_new.[Chg Off
Type], tbl_MasterPop_new.[CHG OFF Date], tbl_MasterPop_new.[Cure Letter
Date], tbl_MasterPop_new.[Skip Active Date], tbl_MasterPop_new.[Skip
Completion Date], tbl_MasterPop_new.[Skip Completion Sts],
tbl_MasterPop_new.[Redeemed Date], tbl_MasterPop_new.[Entered Date],
tbl_MasterPop_new.[Repo Ordered Date], tbl_MasterPop_new.[Active Inactive
Flag] INTO Tbl_MasterPop
FROM tbl_MasterPop_new;
qry_initial(b) makes a table called tbl_masterpop:
SELECT MasterPop.[Loan Acct #], Date() AS PopEnterDt, IIf([chg off date] Is
Not Null And [loan status]=5,"CHARGEOFF",IIf([Inventory Status] In
("IN","SO"),"REPO",IIf([Active Inactive Flag]="A","BK",IIf([Paid Off?]=1 And
[Payoff Date] Is Not Null And [Loan Status]=0 And [Del
Group]="A","CURRENT",IIf([Loan Status]=0 And [Days Delinquent]>0,"PASTDUE_" &
[Del Group],"OTHER"))))) AS Status, "x" AS PrevStatus, MasterPop.[Buying
Center #], MasterPop.[Division Name], MasterPop.[Region Name],
MasterPop.[Group Name], MasterPop.[Collection Center Name],
MasterPop.[Distribution Channel], MasterPop.[New Institution Name],
MasterPop.[Origination Channel], MasterPop.[Sub Channel], MasterPop.[Short
Name], MasterPop.[Loan Status], MasterPop.[Contract Date], MasterPop.[Mat
date], MasterPop.[Next Pmt Due Date], MasterPop.[Payoff Date],
MasterPop.[Paid Off?], MasterPop.[Nbr of Reg Pmts Made], MasterPop.[# Reg
Pmts Remaining], MasterPop.[Pmt Scd Monthly Pmt Amt], MasterPop.[Last Pmt
Date], MasterPop.[Last Pmt Amt], MasterPop.[Amended?], MasterPop.[Amended
This Mo?], MasterPop.[DEL Group], MasterPop.[Days Delinquent], MasterPop.[Tot
Past Due Pmts $], MasterPop.[Principal Balance], MasterPop.[Val Reserve
Dollar Amt], MasterPop.NETBAL, MasterPop.[Ext?], MasterPop.[Extended This
Mo?], MasterPop.[Payoff Dollar Amt], MasterPop.[Flat Void Mth of Orig],
MasterPop.[Active BK Flag Date], MasterPop.[Active BK Flag],
MasterPop.[Inventory Status], MasterPop.[Charge Off Principal],
MasterPop.[Chg Off Type], MasterPop.[CHG OFF Date], MasterPop.[Cure Letter
Date], MasterPop.[Skip Active Date], MasterPop.[Skip Completion Date],
MasterPop.[Skip Completion Sts], MasterPop.[Redeemed Date],
MasterPop.[Entered Date], MasterPop.[Repo Ordered Date], MasterPop.[Active
Inactive Flag] INTO Tbl_MasterPop_New
FROM MasterPop
WHERE (((MasterPop.[Days Delinquent])>0));
This is doing 2 undesireable things:
1. decreasing the speed and efficiency of the database
2. increasong the size of the database to 2GB by creating 2 tables with more
than 100,000 records each
How can I combine these 2 queries?
I was thinking about combining the 2 queries to create one table. From this
new table, I could take out
records which have the same account numbers and put them into a tbl_history.
Any possible way 2 combine these 2 queries? What are the potential
downfalls?
thanks in advance,
geebee
qry_initial(a) makes a table called tbl_masterpop_new:
SELECT tbl_MasterPop_new.[Loan Acct #], tbl_MasterPop_new.PopEnterDt,
tbl_MasterPop_new.Status, "x" AS prevsta, tbl_MasterPop_new.[Buying Center
#], tbl_MasterPop_new.[Division Name], tbl_MasterPop_new.[Region Name],
tbl_MasterPop_new.[Group Name], tbl_MasterPop_new.[Collection Center Name] AS
Expr1, tbl_MasterPop_new.[Distribution Channel], tbl_MasterPop_new.[New
Institution Name], tbl_MasterPop_new.[Origination Channel],
tbl_MasterPop_new.[Sub Channel], tbl_MasterPop_new.[Short Name],
tbl_MasterPop_new.[Loan Status], tbl_MasterPop_new.[Contract Date],
tbl_MasterPop_new.[Mat date], tbl_MasterPop_new.[Next Pmt Due Date],
tbl_MasterPop_new.[Payoff Date], tbl_MasterPop_new.[Paid Off?],
tbl_MasterPop_new.[Nbr of Reg Pmts Made], tbl_MasterPop_new.[# Reg Pmts
Remaining], tbl_MasterPop_new.[Pmt Scd Monthly Pmt Amt],
tbl_MasterPop_new.[Last Pmt Date], tbl_MasterPop_new.[Last Pmt Amt],
tbl_MasterPop_new.[Amended?], tbl_MasterPop_new.[Amended This Mo?],
tbl_MasterPop_new.[DEL Group], tbl_MasterPop_new.[Days Delinquent],
tbl_MasterPop_new.[Tot Past Due Pmts $], tbl_MasterPop_new.[Principal
Balance], tbl_MasterPop_new.[Val Reserve Dollar Amt],
tbl_MasterPop_new.NETBAL, tbl_MasterPop_new.[Ext?],
tbl_MasterPop_new.[Extended This Mo?], tbl_MasterPop_new.[Payoff Dollar Amt],
tbl_MasterPop_new.[Flat Void Mth of Orig], tbl_MasterPop_new.[Active BK Flag
Date], tbl_MasterPop_new.[Active BK Flag], tbl_MasterPop_new.[Inventory
Status], tbl_MasterPop_new.[Charge Off Principal], tbl_MasterPop_new.[Chg Off
Type], tbl_MasterPop_new.[CHG OFF Date], tbl_MasterPop_new.[Cure Letter
Date], tbl_MasterPop_new.[Skip Active Date], tbl_MasterPop_new.[Skip
Completion Date], tbl_MasterPop_new.[Skip Completion Sts],
tbl_MasterPop_new.[Redeemed Date], tbl_MasterPop_new.[Entered Date],
tbl_MasterPop_new.[Repo Ordered Date], tbl_MasterPop_new.[Active Inactive
Flag] INTO Tbl_MasterPop
FROM tbl_MasterPop_new;
qry_initial(b) makes a table called tbl_masterpop:
SELECT MasterPop.[Loan Acct #], Date() AS PopEnterDt, IIf([chg off date] Is
Not Null And [loan status]=5,"CHARGEOFF",IIf([Inventory Status] In
("IN","SO"),"REPO",IIf([Active Inactive Flag]="A","BK",IIf([Paid Off?]=1 And
[Payoff Date] Is Not Null And [Loan Status]=0 And [Del
Group]="A","CURRENT",IIf([Loan Status]=0 And [Days Delinquent]>0,"PASTDUE_" &
[Del Group],"OTHER"))))) AS Status, "x" AS PrevStatus, MasterPop.[Buying
Center #], MasterPop.[Division Name], MasterPop.[Region Name],
MasterPop.[Group Name], MasterPop.[Collection Center Name],
MasterPop.[Distribution Channel], MasterPop.[New Institution Name],
MasterPop.[Origination Channel], MasterPop.[Sub Channel], MasterPop.[Short
Name], MasterPop.[Loan Status], MasterPop.[Contract Date], MasterPop.[Mat
date], MasterPop.[Next Pmt Due Date], MasterPop.[Payoff Date],
MasterPop.[Paid Off?], MasterPop.[Nbr of Reg Pmts Made], MasterPop.[# Reg
Pmts Remaining], MasterPop.[Pmt Scd Monthly Pmt Amt], MasterPop.[Last Pmt
Date], MasterPop.[Last Pmt Amt], MasterPop.[Amended?], MasterPop.[Amended
This Mo?], MasterPop.[DEL Group], MasterPop.[Days Delinquent], MasterPop.[Tot
Past Due Pmts $], MasterPop.[Principal Balance], MasterPop.[Val Reserve
Dollar Amt], MasterPop.NETBAL, MasterPop.[Ext?], MasterPop.[Extended This
Mo?], MasterPop.[Payoff Dollar Amt], MasterPop.[Flat Void Mth of Orig],
MasterPop.[Active BK Flag Date], MasterPop.[Active BK Flag],
MasterPop.[Inventory Status], MasterPop.[Charge Off Principal],
MasterPop.[Chg Off Type], MasterPop.[CHG OFF Date], MasterPop.[Cure Letter
Date], MasterPop.[Skip Active Date], MasterPop.[Skip Completion Date],
MasterPop.[Skip Completion Sts], MasterPop.[Redeemed Date],
MasterPop.[Entered Date], MasterPop.[Repo Ordered Date], MasterPop.[Active
Inactive Flag] INTO Tbl_MasterPop_New
FROM MasterPop
WHERE (((MasterPop.[Days Delinquent])>0));
This is doing 2 undesireable things:
1. decreasing the speed and efficiency of the database
2. increasong the size of the database to 2GB by creating 2 tables with more
than 100,000 records each
How can I combine these 2 queries?
I was thinking about combining the 2 queries to create one table. From this
new table, I could take out
records which have the same account numbers and put them into a tbl_history.
Any possible way 2 combine these 2 queries? What are the potential
downfalls?
thanks in advance,
geebee