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 7057371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:58:41+00:00 2026-05-28T03:58:41+00:00

I have a table that records when a user logs in. I want to

  • 0

I have a table that records when a user logs in.
I want to find all the users that have logged in within the last year.

So, simplified I have

|  Client_ID  |  DateLoggedIn  |
|      1      |    05/02/10    |
|      2      |    14/05/11    |
|      1      |    26/05/11    |
|      3      |    18/04/10    |
|      2      |    21/12/11    |

I’m trying to return the ClientID with the most recent date
eg:

|  Client_ID  |  DateLoggedIn  |
|      1      |    26/05/11    |
|      2      |    21/12/11    |
|      3      |    18/04/10    |

I have tried using Group By and tried the UNION join, but I think I’m doing something wrong…

All help gratefully received !!!

Thanks folks 🙂

  • 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-28T03:58:42+00:00Added an answer on May 28, 2026 at 3:58 am

    Similar to the other Mark:

    select Client_ID, max(DateLoggedIn)
    from table
    where DateLoggedIn > X /* X = one year ago - derivation will be DB-dependant */
    group by Client_ID
    order by max(DateLoggedIn) desc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have about 40000 records in that table that contains plain text and within
I have a table within my database that has many records, some records share
How to select all records from one table that have corespondent keys with other,
I have table that records logins for users. I'm having trouble finding a query
I have a MySQL table that records classified listings. We don't force users to
I have MySQL table that contains all messages from user to user: id |
I have a table that logs user changes with this definition: audit_trail ( change_id
I have hasMany table that records transactions of purchases of users. I'm also about
I have a Logs table in my database where I'm storing records of user
Say you have a ServiceCall database table that records down all the service calls

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.