SQL: Return only first occurrence

前端 未结 5 2181
我在风中等你
我在风中等你 2021-02-19 11:48

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 onl

5条回答
  •  北荒
    北荒 (楼主)
    2021-02-19 12:06

    Add this to your SQL:

    and where not exists
        (select 1 from personAttendances t2 
        where t.personID=t2.personID 
        and t2.seenID < t.seenID)
    

提交回复
热议问题