# BAQ to show the FIRST Operation on a Job
**Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5)
**Created:** 2016-12-06 16:41 UTC
**Views:** 3940
**Replies:** 12
**URL:** https://www.epiusers.help/t/baq-to-show-the-first-operation-on-a-job/36518
---
## Post #1 by @astrys
We have Operations set up so that the production manager can assign jobs to pickers based on the first operation.
I am trying to write a BAQ that will return the first Operation in a job.
Does anyone know what the code might look like to show only the first OpSeq in each job?
This is just a "catch-all" for jobs that do not start with OpSeq 10.
---
## Post #2 by @irus26
Does that help ?
Johnny
---
## Post #3 by @astrys
Unfortunately, no.
I might be missing something though.
---
## Post #4 by @irus26
Do not use Group By for the calculated field
---
## Post #5 by @astrys
I don't think that is working.
I added the Calculated Field and the Syntax was OK, but it is just showing all the OprSeq's.
---
## Post #6 by @irus26
It should work.
First delete everything between JobNum and MinOprSeq.
Test it just with those 2 fields, and then you may insert additional columns.
---
## Post #7 by @Olga
But additional columns will have to be aggregated somehow as well.
---
## Post #8 by @astrys
It is working now, for the most part!
I added all the other columns back in and the results were the same until I tried to add the OpCode back and it showed all of the Operations in each job again.
---
## Post #9 by @Patrick
On the join to JobOper can you select FIRST EACH or LAST like in Epicor 9.
Selecting FIRST would be a much better method than passing all the job operation records and picking the first one for performance reasons.
Patrick Winter
---
## Post #10 by @astrys
I don't think I have that option.
We are on version 10.1.400.13.
---
## Post #11 by @irus26
Try to do min of OpDesc as well
---
## Post #12 by @srossberg
Assuming you need to display data from both the JobHead and JobOper tables I would suggest this:
1. Create an Inner subquery using just the JobOper table.
Select jobNum to display and check group by
Create a calculated field as suggested: MIN(JobOper.OprSeq)
2. Create a top level subquery with all the tables you wish to include
Add the subquery to the top level query
Join the subquery to the JobOper table on JobNum to JobNum and OprSeq to Calculated_OprSeq
---
## Post #13 by @astrys
GREAT!
That worked perfectly.
Thank you so much.
---
**Canonical:** https://www.epiusers.help/t/baq-to-show-the-first-operation-on-a-job/36518
**Original content:** https://www.epiusers.help/t/baq-to-show-the-first-operation-on-a-job/36518