query extracting over over 40,000,000 records

YANECKC

Board Regular
Joined
Jun 13, 2002
Messages
194
I have a query extracting information from three tables.
Table1 has 21,000 security numbers
Table2 has 50,000,000 security numbers and account numbers
Table3 has a OCCD field for each account number
Problem is after extracting the information there is over 40,000,000 records coming back.
The query keeps freezing on me. How can I run a query that only returns the subtotals for each OCCD field ? Meaning the new query should come back and tell me how many accounts for each OCCD.
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

james_lankford

Well-known Member
Joined
Jan 11, 2009
Messages
1,178
hopefully its a simple as
Code:
select 
   [OCCD code], 
   count([Account number]) as CountOfAccountNumber
from 
  Table3
group by 
   [OCCD code]
but could take some time if those fields aren't indexed
 

YANECKC

Board Regular
Joined
Jun 13, 2002
Messages
194
My problem is first i have to extract from Table2 records that match the 21,000 security numbers and get the account numbers from Table2, which will be over 20,000,000 records . too large for output in a table for microsoft 2gig limit. Then from the account numbers on Table2 that the Securities appear in table1 i have to get the oocd codes from table3. That is why i only want the subtotals lines to come back.

Meaning the new query should come back and tell me how many accounts for each OCCD where the securities were match on Table1 and the accounts and securites were matched on table2.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,083
Messages
5,599,643
Members
414,326
Latest member
kfg1287

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
Top