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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:10:45+00:00 2026-06-12T09:10:45+00:00

Generally we use SELECT MAX(datetime) with GROUP BY(page_ID) to get the most recent pages

  • 0

Generally we use SELECT MAX(datetime) with GROUP BY(page_ID) to get the most recent pages but I don’t understand why it doesn’t work here.

My following query should only select rows ID 75 and 77 but its selects 75 and 76 :
enter image description here

SELECT ru.page_ID AS id, 
    pFrom.name AS name,
    UNIX_TIMESTAMP(ru.rating_time) AS action_date,                          
    ru.current_rank AS current_rank,        
    MAX(ru.rating_time)                     
FROM ranks_update ru
INNER JOIN pages pFrom
    ON ru.page_ID = pFrom.page_ID
WHERE ru.ranking_ID = :id_rk
    AND ru.page_ID IN ( ** subquery 1 **)
    AND ru.rating_time >= ( ** subquery  2 **)                      
GROUP BY ru.page_ID                             
ORDER BY ru.current_sum_vote DESC
  • 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-12T09:10:46+00:00Added an answer on June 12, 2026 at 9:10 am
    select ru.page_ID AS id, 
        pFrom.name AS name,
        UNIX_TIMESTAMP(ru.rating_time) AS action_date,                          
        ru.current_rank AS current_rank,        
        rum.MaxDate
    from ranks_update ru
    inner join(
        select page_ID, MAX(rating_time) as MaxDate
        from ranks_update
        WHERE ranking_ID = :id_rk
            AND page_ID IN ( ** subquery 1 **)
            AND rating_time >= ( ** subquery  2 **)   
        group by page_ID
    ) rum on ru.page_ID = rum.page_ID and ru.rating_time = rum.MaxDate
    inner join pages pFrom on ru.page_ID = pFrom.page_ID
    ORDER BY ru.current_sum_vote DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Linq in general, has extensions methods(at IEnumerable) like Where, Select, OrderBy. But use another
I generally use will_paginate for the pagination in my app, but have hit a
I generally use IoC pattern in my projects which are most of the time
I use re.findall(p, text) to match a pattern generally, but now I came across
It's generally best practice to use named constants in place of magic numbers, but
I generally use List<T> for collections. But if I need a fast lookup on
In hibernate we use class names generally in select and update queries.My question is
I generally use this in jquery $(document).ready(function() { //stuff } I was just on
Though internal, I presumed that it is safe to use ConcurrentIdentityWeakKeyHashMap generally. However, the
I use linux screen heavily , generally if the OS didn't restart or say

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.