Job Shop WIP and Late Jobs SQL Query Generator
Most small shops have an ERP database but no good way to ask it simple questions. This generator builds three practical queries from the table and column names you give it.
Fill in
Header table with one row per job
One row per operation on a job
Open jobs with operation hours
SELECT j.Job, j.Customer, j.Part_Number, j.Promised_Date,
SUM(o.Est_Total_Hrs) AS est_hours,
SUM(o.Act_Total_Hrs) AS act_hours
FROM Job j
JOIN Job_Operation o ON o.Job = j.Job
WHERE j.Status = 'Open'
GROUP BY j.Job, j.Customer, j.Part_Number, j.Promised_Date
ORDER BY j.Promised_Date;Late open jobs
SELECT j.Job, j.Customer, j.Part_Number, j.Promised_Date,
DATEDIFF(day, j.Promised_Date, GETDATE()) AS days_late
FROM Job j
WHERE j.Status = 'Open'
AND j.Promised_Date < CAST(GETDATE() AS date)
ORDER BY days_late DESC;Jobs over estimate by more than 10 percent
SELECT j.Job, j.Part_Number,
SUM(o.Est_Total_Hrs) AS est_hours,
SUM(o.Act_Total_Hrs) AS act_hours,
100.0 * (SUM(o.Act_Total_Hrs) - SUM(o.Est_Total_Hrs)) / NULLIF(SUM(o.Est_Total_Hrs), 0) AS pct_over
FROM Job j
JOIN Job_Operation o ON o.Job = j.Job
GROUP BY j.Job, j.Part_Number
HAVING SUM(o.Act_Total_Hrs) > 1.10 * SUM(o.Est_Total_Hrs)
ORDER BY pct_over DESC;Table and column names above are generic examples, not the schema of any specific product. Look up the real names in your ERP's database documentation. The date functions shown are SQL Server syntax, so adjust DATEDIFF and GETDATE for other databases. Run read-only queries against a reporting copy or with a read-only account.
Ask your ERP in plain language
See how a read-only assistant can answer these questions without writing SQL.
Optional. The tool and every export work without this. No spam.
How to use it
Find the job header table and the operations table in your ERP's database documentation, then type their names and the key column names into the fields. The three blocks update immediately. Paste them into your SQL client or reporting tool and run them against a read-only account. Compare the first result to your shop floor board to check that the joins make sense.
- Use a read-only login or a nightly copy of the database
- Test on a few known jobs first
- Check how your ERP stores closed or completed status
What each query tells you
The first query is a plain open jobs list with summed estimated and actual hours. The second lists past-due open jobs by days late. The third highlights jobs where actual hours exceed the estimate by more than ten percent, which is a quick way to find routings that are consistently under-quoted.
Common mistakes
Summing hours after joining several one-to-many tables multiplies the values, so keep the join set small. Status columns are often numeric codes, not text. Time-stamped due dates also need CAST or CONVERT before comparing to today. Always test row counts against the application.
Frequently Asked Questions
Will this work with JobBOSS or E2?
The pattern works with any relational job shop database, but table and column names differ. Replace the defaults with names from your system's data dictionary and test before relying on results.
Is it safe to run SQL against my production ERP?
Read-only SELECT queries are low risk, but heavy joins can slow down the application. Use a read-only account and ideally a reporting copy or off-hours window.
Why do my hours look doubled?
That usually means a join duplicated rows, for example joining operations and material lines in one query. Aggregate each child table separately before combining them.
Can I use this in a reporting tool?
Yes. Paste the SQL into Power BI, SSRS, Excel Power Query or any tool that accepts a custom query, and adjust date syntax to match your database.
If you want to ask these questions in plain language instead of writing SQL, Netray can connect a read-only assistant to your ERP database and show the generated query.
Related Tools
Job Shop KPI Definitions Reference
Standard formulas and ERP data sources for the KPIs a small machine shop should track.
ERP Migration & SelectionJob Shop ERP CSV Import Template Generator
Build clean CSV layouts for parts, routings and customers before loading them into a new job shop ERP.
Costing & FinanceJob Shop Machine Hour Rate Calculator
Work out a loaded hourly rate for a CNC machine or work center and see how utilization changes it.
Discrete ManufacturingJob Shop ERP Glossary Reference
Plain-language definitions of job shop terms, with where each one shows up in ERP data.
More Developer Tools tools
See all- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator
- SAP QM Usage Decision BAPI Skeleton
- ABAP Custom Exception Class Generator
- ABAP Unit Test Class Generator
Keep exploring
Free tools
- Oracle EBS SQL Query Generator for Items and WIP JobsBuild ready-to-run SELECT statements over MTL_SYSTEM_ITEMS_B, WIP_DISCRETE_JOBS and on-hand quantity tables.
- SyteLine SQL Query Generator for Item, Job and Order TablesFill in site, item prefix, job status and date to produce read-only SQL for item master, jobs and open customer order lines.
- Late Purchase Order Lines SQL GeneratorGenerates a SQL query that lists open PO lines past their promise date with days late, plus a roll-up by supplier. Table names are yours to fill in.
ERP fixes and how-tos
- Oracle Work Order Tables: WIP_ENTITIES, WIP_DISCRETE_JOBS and the REST RouteOracle work order tables explained: WIP_ENTITIES, WIP_DISCRETE_JOBS, operations and requirements, with a join query for EBS and the Fusion REST route.
- How to Close a Job Order in SyteLineClose a SyteLine job order the right way: finish routings, issue material, receive finished goods, then run Close Jobs to post WIP to variance accounts.
- How to close job costing and the accounting period in EpicorChecklist for closing a job costing period in Epicor Kinetic: capturing labor and burden, WIP reconciliation, job closing, and GL period close sequencing.
Guides
- Quote vs Actual: Why Aerospace Machine Shop Jobs Lose MoneyHow aerospace machine shops compare quoted and actual cost by job, find the leaks (setup, rework, FAI, outside processing) and feed them back to quoting.
- How to Configure Job Costing in Infor SyteLineConfigure job costing in Infor SyteLine with material, labor, overhead, and outside process cost elements. Complete setup guide for ETO and MTO manufacturers.
- Why Composite Jobs Lose Margin: Actual vs Estimated AnalysisHow composites shops find where job margin goes: actual versus estimated layup hours, material yield, scrap, rework and cure load fill, and how to report it from ERP.
AI on your ERP
- AI for SYSPRO production and job costingHow AI reads SYSPRO WIP jobs, labor and material postings to explain job cost variances and late work orders, with read-only access and on-prem hosting.
- AI for Global Shop Solutions schedulingHow AI reads Global Shop Solutions work orders, routings, and finite schedule data to explain late jobs and test rush orders, read-only and private.
Integrations
- How to add AI agents to ECI E2 Shop SystemHow to add AI agents to ECI E2 Shop System: a read-first tool layer over the E2 SQL database, human approval on writes, and a private on-prem model option.
- How to add AI agents to ECI JobBOSS2How to add AI agents to ECI JobBOSS2: a read-first tool layer over the SQL Server data and API, agents for quotes, late jobs and POs, with human approval on writes.