G
Guest
I have the following wuery:
INSERT INTO Tbl_Archive ( [Loan Acct #], [Date], PopEnterDt, PrevStatus,
Status, [Short Name], [Loan Status], [Contract Date], [Mat date], [Next Pmt
Due Date], [Payoff Date], [Paid Off?], [Nbr of Reg Pmts Made], [# Reg Pmts
Remaining], [Pmt Scd Monthly Pmt Amt], [Last Pmt Date], [Last Pmt Amt],
[Amended?], [Amended This Mo?], [DEL Group], [Days Delinquent], [Tot Past Due
Pmts $], [Principal Balance], [Val Reserve Dollar Amt], NETBAL, [Ext?],
[Extended This Mo?], [Payoff Dollar Amt], [Flat Void Mth of Orig], [Active BK
Flag Date], [Active BK Flag], [Inventory Status], [Charge Off Principal],
[Chg Off Type], [CHG OFF Date], [Cure Letter Date], [Skip Active Date], [Skip
Completion Date], [Skip Completion Sts], [Redeemed Date], [Entered Date],
[Repo Ordered Date], [Active Inactive Flag] ) IN
'C:\DelqPopRes\Temp\tbl_archive.mdb'
SELECT Tbl_MasterPop.[Loan Acct #], CDate([Datex]) AS Expr1,
Tbl_MasterPop.PopEnterDt, Tbl_MasterPop.PrevStatus, Tbl_MasterPop.Status,
Tbl_MasterPop.[Short Name], Tbl_MasterPop.[Loan Status],
Tbl_MasterPop.[Contract Date], Tbl_MasterPop.[Mat date], Tbl_MasterPop.[Next
Pmt Due Date], Tbl_MasterPop.[Payoff Date], Tbl_MasterPop.[Paid Off?],
Tbl_MasterPop.[Nbr of Reg Pmts Made], Tbl_MasterPop.[# Reg Pmts Remaining],
Tbl_MasterPop.[Pmt Scd Monthly Pmt Amt], Tbl_MasterPop.[Last Pmt Date],
Tbl_MasterPop.[Last Pmt Amt], Tbl_MasterPop.[Amended?],
Tbl_MasterPop.[Amended This Mo?], Tbl_MasterPop.[DEL Group],
Tbl_MasterPop.[Days Delinquent], Tbl_MasterPop.[Tot Past Due Pmts $],
Tbl_MasterPop.[Principal Balance], Tbl_MasterPop.[Val Reserve Dollar Amt],
Tbl_MasterPop.NETBAL, Tbl_MasterPop.[Ext?], Tbl_MasterPop.[Extended This
Mo?], Tbl_MasterPop.[Payoff Dollar Amt], Tbl_MasterPop.[Flat Void Mth of
Orig], Tbl_MasterPop.[Active BK Flag Date], Tbl_MasterPop.[Active BK Flag],
Tbl_MasterPop.[Inventory Status], Tbl_MasterPop.[Charge Off Principal],
Tbl_MasterPop.[Chg Off Type], Tbl_MasterPop.[CHG OFF Date],
Tbl_MasterPop.[Cure Letter Date], Tbl_MasterPop.[Skip Active Date],
Tbl_MasterPop.[Skip Completion Date], Tbl_MasterPop.[Skip Completion Sts],
Tbl_MasterPop.[Redeemed Date], Tbl_MasterPop.[Entered Date],
Tbl_MasterPop.[Repo Ordered Date], Tbl_MasterPop.[Active Inactive Flag]
FROM (1_Stg_WBStatus_Flag INNER JOIN Tbl_MasterPop ON
[1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_MasterPop.[Loan Acct #]) LEFT JOIN
Tbl_Archive ON [1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_Archive.[Loan Acct #]
WHERE ((([1_Stg_WBStatus_Flag].histflag)=1));
The only problem is that the query is working VERY slow. It takes 12 hours
to complete, and even then it is not complete. I just have to shut it down.
When I add "top 1000" to the SELECT part of the query, it works faster.
Ideally, I want this query to prevent records from being appended to
tbl_archive if the record is already there for a loan acct # for that date
and with that status is already there, but it is even slower, and I am not
even sure if the syntax is even right to achieve this, as I got multiple
same-records appended:
INSERT INTO Tbl_Archive ( [Loan Acct #], [Date], PopEnterDt, PrevStatus,
Status, [Short Name], [Loan Status], [Contract Date], [Mat date], [Next Pmt
Due Date], [Payoff Date], [Paid Off?], [Nbr of Reg Pmts Made], [# Reg Pmts
Remaining], [Pmt Scd Monthly Pmt Amt], [Last Pmt Date], [Last Pmt Amt],
[Amended?], [Amended This Mo?], [DEL Group], [Days Delinquent], [Tot Past Due
Pmts $], [Principal Balance], [Val Reserve Dollar Amt], NETBAL, [Ext?],
[Extended This Mo?], [Payoff Dollar Amt], [Flat Void Mth of Orig], [Active BK
Flag Date], [Active BK Flag], [Inventory Status], [Charge Off Principal],
[Chg Off Type], [CHG OFF Date], [Cure Letter Date], [Skip Active Date], [Skip
Completion Date], [Skip Completion Sts], [Redeemed Date], [Entered Date],
[Repo Ordered Date], [Active Inactive Flag] ) IN
'C:\DelqPopRes\Temp\tbl_archive.mdb'
SELECT Tbl_MasterPop.[Loan Acct #], CDate([Datex]) AS Expr1,
Tbl_MasterPop.PopEnterDt, Tbl_MasterPop.PrevStatus, Tbl_MasterPop.Status,
Tbl_MasterPop.[Short Name], Tbl_MasterPop.[Loan Status],
Tbl_MasterPop.[Contract Date], Tbl_MasterPop.[Mat date], Tbl_MasterPop.[Next
Pmt Due Date], Tbl_MasterPop.[Payoff Date], Tbl_MasterPop.[Paid Off?],
Tbl_MasterPop.[Nbr of Reg Pmts Made], Tbl_MasterPop.[# Reg Pmts Remaining],
Tbl_MasterPop.[Pmt Scd Monthly Pmt Amt], Tbl_MasterPop.[Last Pmt Date],
Tbl_MasterPop.[Last Pmt Amt], Tbl_MasterPop.[Amended?],
Tbl_MasterPop.[Amended This Mo?], Tbl_MasterPop.[DEL Group],
Tbl_MasterPop.[Days Delinquent], Tbl_MasterPop.[Tot Past Due Pmts $],
Tbl_MasterPop.[Principal Balance], Tbl_MasterPop.[Val Reserve Dollar Amt],
Tbl_MasterPop.NETBAL, Tbl_MasterPop.[Ext?], Tbl_MasterPop.[Extended This
Mo?], Tbl_MasterPop.[Payoff Dollar Amt], Tbl_MasterPop.[Flat Void Mth of
Orig], Tbl_MasterPop.[Active BK Flag Date], Tbl_MasterPop.[Active BK Flag],
Tbl_MasterPop.[Inventory Status], Tbl_MasterPop.[Charge Off Principal],
Tbl_MasterPop.[Chg Off Type], Tbl_MasterPop.[CHG OFF Date],
Tbl_MasterPop.[Cure Letter Date], Tbl_MasterPop.[Skip Active Date],
Tbl_MasterPop.[Skip Completion Date], Tbl_MasterPop.[Skip Completion Sts],
Tbl_MasterPop.[Redeemed Date], Tbl_MasterPop.[Entered Date],
Tbl_MasterPop.[Repo Ordered Date], Tbl_MasterPop.[Active Inactive Flag]
FROM (1_Stg_WBStatus_Flag INNER JOIN Tbl_MasterPop ON
[1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_MasterPop.[Loan Acct #]) LEFT JOIN
Tbl_Archive ON [1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_Archive.[Loan Acct #]
WHERE (((Tbl_Archive.Date) Is Null) AND (([1_Stg_WBStatus_Flag].histflag)=1)
AND ((Tbl_Archive.[Loan Acct #]) Is Null));
There are only 280,000 records in tbl_masterpop, and 0 records in tbl_archive.
What should I do? Someone please help, as I have just been sitting idly at
my desk, seeming incompetent for a week now.
Thanks in advance,
geebee
INSERT INTO Tbl_Archive ( [Loan Acct #], [Date], PopEnterDt, PrevStatus,
Status, [Short Name], [Loan Status], [Contract Date], [Mat date], [Next Pmt
Due Date], [Payoff Date], [Paid Off?], [Nbr of Reg Pmts Made], [# Reg Pmts
Remaining], [Pmt Scd Monthly Pmt Amt], [Last Pmt Date], [Last Pmt Amt],
[Amended?], [Amended This Mo?], [DEL Group], [Days Delinquent], [Tot Past Due
Pmts $], [Principal Balance], [Val Reserve Dollar Amt], NETBAL, [Ext?],
[Extended This Mo?], [Payoff Dollar Amt], [Flat Void Mth of Orig], [Active BK
Flag Date], [Active BK Flag], [Inventory Status], [Charge Off Principal],
[Chg Off Type], [CHG OFF Date], [Cure Letter Date], [Skip Active Date], [Skip
Completion Date], [Skip Completion Sts], [Redeemed Date], [Entered Date],
[Repo Ordered Date], [Active Inactive Flag] ) IN
'C:\DelqPopRes\Temp\tbl_archive.mdb'
SELECT Tbl_MasterPop.[Loan Acct #], CDate([Datex]) AS Expr1,
Tbl_MasterPop.PopEnterDt, Tbl_MasterPop.PrevStatus, Tbl_MasterPop.Status,
Tbl_MasterPop.[Short Name], Tbl_MasterPop.[Loan Status],
Tbl_MasterPop.[Contract Date], Tbl_MasterPop.[Mat date], Tbl_MasterPop.[Next
Pmt Due Date], Tbl_MasterPop.[Payoff Date], Tbl_MasterPop.[Paid Off?],
Tbl_MasterPop.[Nbr of Reg Pmts Made], Tbl_MasterPop.[# Reg Pmts Remaining],
Tbl_MasterPop.[Pmt Scd Monthly Pmt Amt], Tbl_MasterPop.[Last Pmt Date],
Tbl_MasterPop.[Last Pmt Amt], Tbl_MasterPop.[Amended?],
Tbl_MasterPop.[Amended This Mo?], Tbl_MasterPop.[DEL Group],
Tbl_MasterPop.[Days Delinquent], Tbl_MasterPop.[Tot Past Due Pmts $],
Tbl_MasterPop.[Principal Balance], Tbl_MasterPop.[Val Reserve Dollar Amt],
Tbl_MasterPop.NETBAL, Tbl_MasterPop.[Ext?], Tbl_MasterPop.[Extended This
Mo?], Tbl_MasterPop.[Payoff Dollar Amt], Tbl_MasterPop.[Flat Void Mth of
Orig], Tbl_MasterPop.[Active BK Flag Date], Tbl_MasterPop.[Active BK Flag],
Tbl_MasterPop.[Inventory Status], Tbl_MasterPop.[Charge Off Principal],
Tbl_MasterPop.[Chg Off Type], Tbl_MasterPop.[CHG OFF Date],
Tbl_MasterPop.[Cure Letter Date], Tbl_MasterPop.[Skip Active Date],
Tbl_MasterPop.[Skip Completion Date], Tbl_MasterPop.[Skip Completion Sts],
Tbl_MasterPop.[Redeemed Date], Tbl_MasterPop.[Entered Date],
Tbl_MasterPop.[Repo Ordered Date], Tbl_MasterPop.[Active Inactive Flag]
FROM (1_Stg_WBStatus_Flag INNER JOIN Tbl_MasterPop ON
[1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_MasterPop.[Loan Acct #]) LEFT JOIN
Tbl_Archive ON [1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_Archive.[Loan Acct #]
WHERE ((([1_Stg_WBStatus_Flag].histflag)=1));
The only problem is that the query is working VERY slow. It takes 12 hours
to complete, and even then it is not complete. I just have to shut it down.
When I add "top 1000" to the SELECT part of the query, it works faster.
Ideally, I want this query to prevent records from being appended to
tbl_archive if the record is already there for a loan acct # for that date
and with that status is already there, but it is even slower, and I am not
even sure if the syntax is even right to achieve this, as I got multiple
same-records appended:
INSERT INTO Tbl_Archive ( [Loan Acct #], [Date], PopEnterDt, PrevStatus,
Status, [Short Name], [Loan Status], [Contract Date], [Mat date], [Next Pmt
Due Date], [Payoff Date], [Paid Off?], [Nbr of Reg Pmts Made], [# Reg Pmts
Remaining], [Pmt Scd Monthly Pmt Amt], [Last Pmt Date], [Last Pmt Amt],
[Amended?], [Amended This Mo?], [DEL Group], [Days Delinquent], [Tot Past Due
Pmts $], [Principal Balance], [Val Reserve Dollar Amt], NETBAL, [Ext?],
[Extended This Mo?], [Payoff Dollar Amt], [Flat Void Mth of Orig], [Active BK
Flag Date], [Active BK Flag], [Inventory Status], [Charge Off Principal],
[Chg Off Type], [CHG OFF Date], [Cure Letter Date], [Skip Active Date], [Skip
Completion Date], [Skip Completion Sts], [Redeemed Date], [Entered Date],
[Repo Ordered Date], [Active Inactive Flag] ) IN
'C:\DelqPopRes\Temp\tbl_archive.mdb'
SELECT Tbl_MasterPop.[Loan Acct #], CDate([Datex]) AS Expr1,
Tbl_MasterPop.PopEnterDt, Tbl_MasterPop.PrevStatus, Tbl_MasterPop.Status,
Tbl_MasterPop.[Short Name], Tbl_MasterPop.[Loan Status],
Tbl_MasterPop.[Contract Date], Tbl_MasterPop.[Mat date], Tbl_MasterPop.[Next
Pmt Due Date], Tbl_MasterPop.[Payoff Date], Tbl_MasterPop.[Paid Off?],
Tbl_MasterPop.[Nbr of Reg Pmts Made], Tbl_MasterPop.[# Reg Pmts Remaining],
Tbl_MasterPop.[Pmt Scd Monthly Pmt Amt], Tbl_MasterPop.[Last Pmt Date],
Tbl_MasterPop.[Last Pmt Amt], Tbl_MasterPop.[Amended?],
Tbl_MasterPop.[Amended This Mo?], Tbl_MasterPop.[DEL Group],
Tbl_MasterPop.[Days Delinquent], Tbl_MasterPop.[Tot Past Due Pmts $],
Tbl_MasterPop.[Principal Balance], Tbl_MasterPop.[Val Reserve Dollar Amt],
Tbl_MasterPop.NETBAL, Tbl_MasterPop.[Ext?], Tbl_MasterPop.[Extended This
Mo?], Tbl_MasterPop.[Payoff Dollar Amt], Tbl_MasterPop.[Flat Void Mth of
Orig], Tbl_MasterPop.[Active BK Flag Date], Tbl_MasterPop.[Active BK Flag],
Tbl_MasterPop.[Inventory Status], Tbl_MasterPop.[Charge Off Principal],
Tbl_MasterPop.[Chg Off Type], Tbl_MasterPop.[CHG OFF Date],
Tbl_MasterPop.[Cure Letter Date], Tbl_MasterPop.[Skip Active Date],
Tbl_MasterPop.[Skip Completion Date], Tbl_MasterPop.[Skip Completion Sts],
Tbl_MasterPop.[Redeemed Date], Tbl_MasterPop.[Entered Date],
Tbl_MasterPop.[Repo Ordered Date], Tbl_MasterPop.[Active Inactive Flag]
FROM (1_Stg_WBStatus_Flag INNER JOIN Tbl_MasterPop ON
[1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_MasterPop.[Loan Acct #]) LEFT JOIN
Tbl_Archive ON [1_Stg_WBStatus_Flag].[Loan Acct #] = Tbl_Archive.[Loan Acct #]
WHERE (((Tbl_Archive.Date) Is Null) AND (([1_Stg_WBStatus_Flag].histflag)=1)
AND ((Tbl_Archive.[Loan Acct #]) Is Null));
There are only 280,000 records in tbl_masterpop, and 0 records in tbl_archive.
What should I do? Someone please help, as I have just been sitting idly at
my desk, seeming incompetent for a week now.
Thanks in advance,
geebee