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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:36:52+00:00 2026-06-10T12:36:52+00:00

I got the IDs(the rows to be updated) in this query from post table,

  • 0

I got the IDs(the rows to be updated) in this query from post table, with those IDs as rows in grade table, I want to set one var to 1, and others in this array to 0, and keep the rest rows in the grade table unchanged:

SELECT ID FROM posts
WHERE post_parent = ''
AND post_status IN ( '')
AND post_type = ''

I’d like to learn how to update the grade table as described above. Thanks!

  • 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-10T12:36:54+00:00Added an answer on June 10, 2026 at 12:36 pm

    You can use this solution:

    UPDATE grade g
    JOIN   post p ON g.id          = p.id
                 AND p.post_parent = $parent_id
                 AND p.post_status = $post_status
                 AND p.post_type   = $post_type
    SET    g.grade = CASE WHEN g.id = $id THEN 1 ELSE 0 END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a one to many table with ids and traits for those users.
I have a situation where I want to associate multiple values from one table
I got a table of ids from 1 to 1000. How can I select
Ok, so I've got this table called exp_category_posts that's in charge of storing the
I got a table with a normal setup of auto inc. ids. Some of
I've got an array of 200 numbers (item ids) and I want to get
I've got a table with the type ahead feature from jQuery UI. It is
I've got a simple table that is storing unique IDs tied to a download.
I've got a list of items in a certain table and I want to
I'm trying to find the rows that are in one table but not another,

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.