It took a day-and-a-half of banging my head on the desk, but I figured out how to write this damned query. Sheesh.
SQL?
Yeah. Had to select which of one or more children of a particular guardian has the birthdate closest to the guardian's enroll date.
Definitely not my forte. I was dealing with a proxy server issue. Gee, I hate Windows.
Would have been easy in a properly normalized database, or if I could just write some C# code. As it was, this was all coming from one query, and my query had to replace another query and have the same fields but return the index child correctly. So, required a self-join to an aggregate query, and one of the join conditions had to be the return value of an aggregate function. Total fuster-cluck. But I did it.