- Local time
- Yesterday, 19:07
- Joined
- Feb 28, 2001
- Messages
- 28,972
My approach divides the problem into discrete parts.I would be interested in the reasoning.
The IIF() expression gives you which of the two fields in the same record was earlier but not null. The bizarre date simply prevents nulls from popping up in an ugly way.
From there, you can build your 2nd-layer query as a list, ORDER BY and GROUP BY as the problem warrants, without so many convoluted steps involving sub-queries.
Look at it this way. A simple layered query may be the same number of internal query elements as a query/sub-query combo. But it is FAR easier to see and understand as a way to get the minimum meaningful date on a given record AND THEN be able to compare those dates across records in a list, sort them, group them, or whatever.
All of the complex sub-queries jump through complex hoops for what is a simple two-part problem... MIN within a row, then MIN across rows.