Need help with the getting a top 1 record with in a table with same ids

  • Lynn Pettis - Thursday, July 19, 2018 12:03 PM

    sgmunson - Thursday, July 19, 2018 11:49 AM

    Just one comment on this...   What, exactly, does "closest" mean?   The reason I ask this is because let's say an event spans today by starting before today and ending after today, and you want the "closest" date.   Is that today, or is it both yesterday AND tomorrow?   Or if the event starts today and ends some day later than today, do you define "closest" as today or tomorrow?   Similarly, if an event starts before today, and ends today, do you want yesterday or today?   I know this analysis may seem like overkill, but without being able to answer such questions, at this somewhat anal level of detail, it's usually a guessing game as to what exactly someone means, and can complicate someone being able to help you without going through a lot of iterations to finally figure it out.

    Based on what the OP stated when asked this question earlier, the greater than but closest to today.  For today, 2018-07-19, that could be 2018-07-20 if that is the date closest for a given event.

    I looked at the originally supplied results and came to the conclusion that the definition of "closest" was going to be a problem, given your interpretation and repeated attempts to get the right answer.   Just wanted to call attention to the fact that it's really easy to have two people look at the same thing and come to entirely different conclusions because one term might get interpreted somewhat differently, or might simply appear to be vague to one party and not another, along with the difficulty and wasted time so often associated with that.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson - Thursday, July 19, 2018 12:14 PM

    Lynn Pettis - Thursday, July 19, 2018 12:03 PM

    sgmunson - Thursday, July 19, 2018 11:49 AM

    Just one comment on this...   What, exactly, does "closest" mean?   The reason I ask this is because let's say an event spans today by starting before today and ending after today, and you want the "closest" date.   Is that today, or is it both yesterday AND tomorrow?   Or if the event starts today and ends some day later than today, do you define "closest" as today or tomorrow?   Similarly, if an event starts before today, and ends today, do you want yesterday or today?   I know this analysis may seem like overkill, but without being able to answer such questions, at this somewhat anal level of detail, it's usually a guessing game as to what exactly someone means, and can complicate someone being able to help you without going through a lot of iterations to finally figure it out.

    Based on what the OP stated when asked this question earlier, the greater than but closest to today.  For today, 2018-07-19, that could be 2018-07-20 if that is the date closest for a given event.

    I looked at the originally supplied results and came to the conclusion that the definition of "closest" was going to be a problem, given your interpretation and repeated attempts to get the right answer.   Just wanted to call attention to the fact that it's really easy to have two people look at the same thing and come to entirely different conclusions because one term might get interpreted somewhat differently, or might simply appear to be vague to one party and not another, along with the difficulty and wasted time so often associated with that.

    Which is exactly what I had asked and he gave the definition I then used for my final answer.

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply