Skip to content
Advertisement

SQL: Return only first occurrence

I seldomly use SQL and I cannot find anything similar in my archive so I’m asking this simple query question: I need a query which one returns personID and only the first seenTime

Records:

Wanted result:

That’s what I did & failed:

P.S: Notice SQL CE 4

Advertisement

Answer

If your seenTime increases as seenID increases:

Update for another case:

If this is not the case, and you really want the seenTime that corresponds with the minimum seenID (assuming seenID is unique):

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement