SQL Going really slow but code works any tips?

Dark0Prince

Active Member
Joined
Feb 17, 2016
Messages
433
Any idea what I can do to speed this up it goes super fast when i run it from telnet. When i use SQL to pull into excel this report takes super long. Here's the code. The question marks are using the client number in excel and a date like today()-1460 formula, because I don't know how to write that into the code. TIPS appreciated.

Code:
SELECT Debtor_Master_Logic_Blocks8.PROG_REPORT_ACCT_NUM_AND_PRACCT, Dbtr_Clnt_Generl_Inf.Date_Listed, Dbtr_Balances.INITIAL_BALANCE, Dbtr_Status.Last_Payment, Letter_Variables.Amt_Paid_On_Acct, Dbtr_Balances.Principal_Balance, Debtor_Master_Logic_Blocks7.INVENT_INVEN2
FROM SQLUser.Dbtr_Balances Dbtr_Balances, SQLUser.Dbtr_Clnt_Generl_Inf Dbtr_Clnt_Generl_Inf, SQLUser.Dbtr_Status Dbtr_Status, SQLUser.Debtor_Master_Logic_Blocks7 Debtor_Master_Logic_Blocks7, SQLUser.Debtor_Master_Logic_Blocks8 Debtor_Master_Logic_Blocks8, SQLUser.Letter_Variables Letter_Variables
WHERE Dbtr_Balances.ACCOUNT_NUM = Dbtr_Clnt_Generl_Inf.ACCOUNT_NUM AND Dbtr_Balances.ACCOUNT_NUM = Dbtr_Status.ACCOUNT_NUM AND Dbtr_Balances.ACCOUNT_NUM = Debtor_Master_Logic_Blocks7.ACCOUNT_NUM AND Dbtr_Balances.ACCOUNT_NUM = Debtor_Master_Logic_Blocks8.ACCOUNT_NUM AND Dbtr_Balances.ACCOUNT_NUM = Letter_Variables.ACCOUNT_NUM AND Dbtr_Clnt_Generl_Inf.ACCOUNT_NUM = Dbtr_Status.ACCOUNT_NUM AND Dbtr_Clnt_Generl_Inf.ACCOUNT_NUM = Debtor_Master_Logic_Blocks7.ACCOUNT_NUM AND Dbtr_Clnt_Generl_Inf.ACCOUNT_NUM = Debtor_Master_Logic_Blocks8.ACCOUNT_NUM AND Dbtr_Clnt_Generl_Inf.ACCOUNT_NUM = Letter_Variables.ACCOUNT_NUM AND Dbtr_Status.ACCOUNT_NUM = Debtor_Master_Logic_Blocks7.ACCOUNT_NUM AND Dbtr_Status.ACCOUNT_NUM = Debtor_Master_Logic_Blocks8.ACCOUNT_NUM AND Dbtr_Status.ACCOUNT_NUM = Letter_Variables.ACCOUNT_NUM AND Debtor_Master_Logic_Blocks7.ACCOUNT_NUM = Debtor_Master_Logic_Blocks8.ACCOUNT_NUM AND Debtor_Master_Logic_Blocks7.ACCOUNT_NUM = Letter_Variables.ACCOUNT_NUM AND Debtor_Master_Logic_Blocks8.ACCOUNT_NUM = Letter_Variables.ACCOUNT_NUM AND (Dbtr_Clnt_Generl_Inf.Client=?) AND (Dbtr_Clnt_Generl_Inf.Date_Listed>?)
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top