Need help speeding up query on two huge linked tables? (1 Viewer)

kmsmith

New member
Local time
Today, 11:54
Joined
Sep 19, 2017
Messages
8
So I have two huge linked tables, and I want to conduct a fairly complex query on them. I've managed to extract the data I need, but my process uses multiple sub queries and it's just too slow for my DB users.

Table 2 shows Facility ID, fluid type, fluid amount, and reporting date (as year and month, when I'd ultimately like year only).

Table 1 links Facility ID to Company ID, which I would ultimately like displayed rather than Facility ID (note that one company has many facilities). This table stores historical data as Company's often swap facilities, so only the most recent update date for each facility is required.

My output should be sorted by company, amount of fluid (with a different field for each fluid type), and year.

I'd love to hear any of your ideas on how to trim this down to a concise SQL statement!

Cheers,

-K
 

Attachments

  • Capture.jpg
    Capture.jpg
    82.9 KB · Views: 92

Ranman256

Well-known member
Local time
Today, 14:54
Joined
Apr 9, 2015
Messages
4,339
your base query (1 year or other date range) would pull the main data and add YEAR field: Yr: year(date)

then next query would use the above qry then sum by year (and/or dept etc)
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 19:54
Joined
Jul 9, 2003
Messages
16,272
Please post the SQL Statements of your current Query/Queries ...
 

Users who are viewing this thread

Top Bottom