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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:26:24+00:00 2026-06-03T02:26:24+00:00

I have a table that goes as follows: content_id | contact_count 1 23 2

  • 0

I have a table that goes as follows:

content_id | contact_count
         1              23
         2               4
         3              89

I want to select the content_id with the highest contact_count from the last 25 rows of the table.

I’ve tried many different things such as:

select content_id from research_products_content
   where contact_count=(select max(contact_count)
        from research_products_content order by rating_total_id desc limit 25)
   order by rating_total_id desc limit 1
  • 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-03T02:26:25+00:00Added an answer on June 3, 2026 at 2:26 am

    In your example, limit 25 is applied after the result (max, which is a single row) is selected. Try this instead:

    SELECT tmp.content_id FROM (
      SELECT *
      FROM research_products_content
      ORDER BY rating_total_id DESC
      LIMIT 25
      ) AS tmp
    WHERE tmp.contact_count = (
      SELECT max(tmp2.contact_count)
      FROM (
        SELECT *
        FROM research_products_content
        ORDER BY rating_total_id DESC
        LIMIT 25
      ) AS tmp2
    )
    LIMIT 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL query that goes as follows SELECT count(`clicks`.`user_id`) as total, `users`.`fullname`
Say I have a table that goes clockwise like this: 2 1 3 0
I have table that I insert data with following query (from c# code): INSERT
I have a table that records distance from Google/Bing between two valid UK postcodes.
I have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45
I have a table that contains multiple dropdown menus for a list of profile
I have a table that looks like this: id value AGA 0.211 AGA 0.433
I have a table that looks like this: CREATE TABLE foobar ( id SERIAL
I have a table that acts as a dropbox for files that get automatically
I have a table that has account numbers in (account_num) and user profiles (profile_id).

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.