Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7036925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:28:55+00:00 2026-05-28T01:28:55+00:00

I seldomly use SQL and I cannot find anything similar in my archive so

  • 0

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:

seenID | personID | seenTime
   108      3         13:34
   109      2         13:56
   110      3         14:22
   111      3         14:31
   112      4         15:04
   113      2         15:52

Wanted result:

personID | seenTime
   3         13:34
   2         13:56
   4         15:04

That’s what I did & failed:

SELECT t.attendanceID, t.seenPersonID, t.seenTime
(SELECT ROW_NUMBER() OVER (PARTITION BY seenID ORDER BY seenID) AS RowNo,
seenID,
seenPersonID,
seenTime
FROM personAttendances) t
WHERE t.RowNo=1

P.S: Notice SQL CE 4

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:28:56+00:00Added an answer on May 28, 2026 at 1:28 am

    If your seenTime increases as seenID increases:

    select personID, min(seenTime) as seenTime
    from personAttendances
    group by personID
    

    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):

    select a.personID, a.seenTime
    from personAttendances as a
        join (
            -- Get the min seenID for each personID
            select personID, min(seenID) as seenID
            from personAttendances
            group by personID
        ) as b on a.personID = b.personID
    where a.seenID = b.seenID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Object-databases are used very seldomly, albeit they offer a way to live without SQL,
Is there an Unicode symbol representing puzzle pieces? There are lots of seldomly used
Short version: For a cache class I need to get notified if an object
I am creating a few JAX-WS endpoints, for which I want to save the
INFORMIX-SQL 7.32 (SE) Linux Pawnshop App. I have some users who own several pawnshops
I've been looking at Sharepoint script files and I've come across this bit that
I have the following statement to find unambiguous names in my data (~1 Million
I consider caching key-value lists stored in database. Right now for rendering of JSF
I'm working on implementing data caching for commonly used database objects and I'm having

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.