Labor audit to BAQ only the 1st labor detail record NOT ALL REC's

LABOR AUDIT… review labor detail rec’s with analysis of Lab-head entry to 1st lab-detail
Situation: Employee will clock-in, but (perhaps) not log-into a job immediately.
This is OK, if they clock-in before shift-start, starting lab-detail close-to shift begin

BAQ link Lab-Head to Lab-detail
Lab head has a Seq # and Lab-detail has a seq# per each record against job/op, therefore the lab-dtail lowest seq # per each lab-head would be the 1st labor-detail against JOB/op.
Employee works 5 days this week. ERGO 5 lab-head recs, each with an increasing and unique lab-head seq #. Per each lab-head, the Lab-detail recs have increasing seq #'s.

SQL does have a min-date function… but the date in the labor tables does not include TIME. The time(s) are stored in separate fields. With all DATES being the same… can’t attain results based on date fields.

How to limit the SUB-QUERY in the BAQ to ONLY the lowest seq # of the Lab-detail per each Lab-Head Seq # ???

You can use a CTE to get the min sequence / date , etc and then join up to that.

1st CTE??
2nd in prior post, the date is not storing time, so need to focus on LAB-Detail seq # to get lowest entry per that date.

Sorry I do not follow

You stated in your prior post
“You can use a CTE to get the min sequence / date , etc and then join up to that”

so I said 1st Question CTE??? huh?

then foolishly, I missed your post indicating you can use CTE on the SEQ#
so ignore the rest of my prior post!

OK - CTE totally unfamiliar on use of CTS in a BAQ

If you’re not familiar with CTE then wouldn’t a min(labordtl.laborseq) and group by laborhed.laborhedseq work?

I’m not saying don’t learn CTE because it has many uses but this seems like a simple solution unless i’m misunderstanding.

Not familiar with CTE…

As for your suggestion:
a min(labordtl.laborseq) and group by laborhed.laborhedseq work?

While I have a good number of years of EPICOR, just getting deeper into BAQ’s, etc…
Any guidance on deploying this tidbit?
I have access to 3.1.400 EPICOR ICE manual but it is a lot to digest…

Try this BAQ…

Table LaborHed joined to LaborDtl.
Display fields LaborHed.LaborHedSeq (check the groupby checkbox on the display fields)
Create a calculated field, label it, make it an int, use “MIN(LaborDtl.LaborSeq)” in your expression without the quotes.

See if that gets you the basic results you’re looking for. If so you should be able to build it from that point on. Just remember any additional non aggregated fields will need to be grouped.