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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:24:13+00:00 2026-05-19T01:24:13+00:00

I was trying to run the following query UPDATE blog_post SET `thumbnail_present`=0, `thumbnail_size`=0, `thumbnail_data`=”

  • 0

I was trying to run the following query

UPDATE blog_post SET `thumbnail_present`=0, `thumbnail_size`=0, `thumbnail_data`=''
WHERE `blog_post` NOT IN (
 SELECT `blog_post`
 FROM blog_post
 ORDER BY `blog_post` DESC
 LIMIT 10)

But Mysql doesn’t allow ‘LIMIT’ in an ‘IN’ subquery.

I think I can make a select to count the table rows and then make an ordered update limited by ‘COUNT – 10’, but I was wondering if there is a better way.

Thanks in advance.

  • 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-19T01:24:14+00:00Added an answer on May 19, 2026 at 1:24 am

    think i understood you right:

    update blog_post bp
    left outer join
    (
    select 
     post_id -- what's your PK again ??
    from 
     blog_post
    order by
     post_id desc limit 10
    ) latest on latest.post_id = bp.post_id
    set 
      bp.thumbnail_present = 0 -- add more fields
    where
     latest.post_id is null;
    

    EDIT

    I’ve renamed the fields as you can’t seem to take a hint !

    update blog_post bp
    left outer join
    (
    select 
     blog_post 
    from 
     blog_post
    order by
     blog_post desc limit 10
    ) latest on latest.blog_post = bp.blog_post
    set 
      bp.thumbnail_present = 0
    where
     latest.blog_post is null;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run the following query using phpMyAdmin: UPDATE TABLE x SET `number`
I am trying to run the following script (unsuccessfully): $variables = $db->query(SELECT * FROM
i was trying to run this query: ( (SELECT * FROM (SELECT * FROM
I am trying to run a query like UPDATE myTable SET Name='B&L' WHERE ID
Trying to run the following HQL with NHibernate: select count(distinct t) as TweetCount from
I am using SQL Server 2008, and trying to run the following query in
The following SQL I am trying to run is returning sql_string of SELECT id
I'm trying to run the following commands: replace -x must A2input.txt replace -x a
I'm trying to run the following command: find . -iname '.#*' -print0 | xargs
Hey everyone, I am trying to run the following program, but am getting a

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.