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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:02:20+00:00 2026-06-15T02:02:20+00:00

how can i put together a macro/script/something automatic that will allow me to make

  • 0

how can i put together a macro/script/something automatic that will allow me to make the following changes to my database in mass:

if any cell in column 1 is X, then change the contents of column 2 (in the same row) to 0.
if the cell in column 1 is not X, then leave the contents of column 2 alone.

  • 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-15T02:02:21+00:00Added an answer on June 15, 2026 at 2:02 am

    This is just a simple UPDATE statement with a WHERE clause. Run once to update all rows in your table.

    UPDATE yourtable SET column2 = 0 WHERE column1 = 'X'
    

    If you need to automatically update column2 to 0 whenever column1 is changed to X, create a BEFORE UPDATE trigger.

    /* DELIMITER has been set to $$ in your client */
    CREATE TRIGGER column1_is_X BEFORE UPDATE ON yourtable
    FOR EACH ROW
    BEGIN
      IF NEW.column1 = 'X' THEN
        SET NEW.column2 = 0;
      END IF;
    END$$
    /* Then you should set the DELIMITER back to ; */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone can help me please. I've put together the script below
I've looked around and have bits and pieces but can't put the puzzle together.
I am trying to put a layout together with jquery-ui-layout and can't overcome the
I hope someone can help us. We’re trying to put together an image editor,
Wondering if anyone can help me. I'm trying to put together a weekly photo
I wonder whether someone can help me please. I've put together this page, which
This is code I've put together so far. I've found where you can add
I wonder whether someone can help me please. I've put together this page which
I wonder whether someone can help me please. I've put together the code below
Can anyone help me with a MySQL query I'm trying to put together. I

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.