Pretty sure you just need a couple extra joins here to make this work. Also, please notice that I created an explicit inner join between Order and OrderHeaders. This style of join has been around for nearly 30 years now and should be used in favor of the ANSI-89 style joins as posted.
SELECT O.orderID
, H.dateordered
, O.secondaryID
, O.custname
, oa.arrivedate
, c.actiondate
FROM Orders as O
join OrderHeaders as H on O.secondaryID = H.secondaryID
join OrderAuxiliary oa on oa.orderID = o.orderID
and mode = 'action taken'
and descrip like '%time of action%'
join comments c on c.secondaryID = H.dateordered
and c.modetype = 'A1'
WHERE O.dateordered between @starting AND @ending
GROUP BY
O.orderID
, H.dateordered
, O.secondaryID
, O.custname
ORDER BY H.dateordered
I believe this is on the right track, thanks a ton ! I was also considering CTE parsing, or maybe if a CURSOR was the right way to deal with each row for the result, but I'll continue testing.
Zo