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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:50:58+00:00 2026-06-11T01:50:58+00:00

I have a table that stores all data that a user answers. I am

  • 0

I have a table that stores all data that a user answers. I am trying to find out which user_id’s have not updated anything in the system since Jan 1, 2012.

Each user will have about 500 item_id’s in the database. The query I am trying to process will return the DISTINCT user_id of every user that has not updated their data since a given year. Not all item_id’s have to be updated so if any item_id has a dt greater than the datetime I am trying to find then I need to ignore them, even if it’s 1 record. I only want user_id’s that have not updated a single field since 2012.

Any help or push in the right direction is appreciated.

Thanks!

The table

CREATE TABLE IF NOT EXISTS `item_results` (
`item_id` int(11) NOT NULL DEFAULT '0',
`user_id` int(11) NOT NULL DEFAULT '0',
`result` text NOT NULL,
`specifier` text NOT NULL,
`dt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
UNIQUE KEY `item_id` (`item_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  • 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-06-11T01:51:00+00:00Added an answer on June 11, 2026 at 1:51 am

    You need to create a subquery that gets their latest dt value (MAX VALUE) like this one below (it works if you want to get all the columns of the last update of the user.)

    SELECT  a.*
    FROM item_results b
            INNER JOIN
            (
                SELECT user_id, MAX(`dt`) lastUpdated
                FROM item_results
                GROUP BY userID
            ) a ON a.user_ID = b.user_ID AND
                   a.lastUpdated = b.`dt`
    WHERE DATE(a.lastUpdated) < '2012-01-01'
    

    or simply (the one you are looking for.)

    SELECT user_id
    FROM item_results
    GROUP BY userID
    HAVING DATE(MAX(`dt`)) < '2012-01-01'
    

    Hope this helps.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Pages table that stores all my view urls and this table
I have a table that stores data that has been entered regarding the amount
I have a table that stores user information. The table has a userid (identity)
I have a table that stores the data as follows: ID ListId ModuleId RecordId
I have a table User that stores user information - such as name, date
In my DB i have a table that stores my site settings per user.
I have a table that stores email in 3 diffrent columns name host and
I have a table that stores various clients I have done work for, separated
I have a table that stores employee names and years they worked. The columns
I have mysql table that has a column that stores xml as a string.

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.