pmnum is not null and pmnum in (select pmnum from workorder group by pmnum having count(wonum) <= 4)
It's possible that the PM Counter could have been adjusted, especially if you have Job Plan Sequences in use -- so that the Counter is greater than 4, but it hasn't actually generated 4 Work Orders.
At least in my usage, I wouldn't rely on the Work Order's Work Type to determine if it is a PM or not. The most reliable source is if WORKORDER.PMNUM is null or not (at least for finding the Parent WOs that came from PMs; not so much for Children created from a PM that has a Route. . .)
------------------------------
Travis Herron
Pensacola Christian College
------------------------------