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

  • Home
  • SEARCH
  • 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 1074553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:08:41+00:00 2026-05-16T21:08:41+00:00

DELETE FROM Table1 WHERE ConditionID=?ConditionID; DELETE FROM Table2 WHERE ConditionID=?ConditionID; DELETE FROM Table3 WHERE

  • 0

DELETE FROM Table1 WHERE ConditionID=?ConditionID;

DELETE FROM Table2 WHERE ConditionID=?ConditionID;

DELETE FROM Table3 WHERE ConditionID=?ConditionID;

ConditionID is a column present in Table1,Table2,Table3, instead of running 3 times individually, is there a way to run all the three in a single query (in mysql)?

  • 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-16T21:08:43+00:00Added an answer on May 16, 2026 at 9:08 pm

    If the ConditionID is the same for all the three tables, you should be able to use the Multiple Table Delete Syntax:

    DELETE Table1, Table2, Table3
    FROM   Table1
    JOIN   Table2 ON (Table2.ConditionID = Table1.ConditionID)
    JOIN   Table3 ON (Table3.ConditionID = Table2.ConditionID)
    WHERE  Table1.ConditionID = ?;
    

    Test case:

    CREATE TABLE Table1 (id int, ConditionID int);
    CREATE TABLE Table2 (id int, ConditionID int);
    CREATE TABLE Table3 (id int, ConditionID int);
    
    INSERT INTO Table1 VALUES (1, 100);
    INSERT INTO Table1 VALUES (2, 100);
    INSERT INTO Table1 VALUES (3, 200);
    
    INSERT INTO Table2 VALUES (1, 100);
    INSERT INTO Table2 VALUES (2, 200);
    INSERT INTO Table2 VALUES (3, 300);
    
    INSERT INTO Table3 VALUES (1, 100);
    INSERT INTO Table3 VALUES (2, 100);
    INSERT INTO Table3 VALUES (3, 100);
    

    Result:

    DELETE Table1, Table2, Table3
    FROM   Table1
    JOIN   Table2 ON (Table2.ConditionID = Table1.ConditionID)
    JOIN   Table3 ON (Table3.ConditionID = Table2.ConditionID)
    WHERE  Table1.ConditionID = 100;
    
    SELECT * FROM Table1;
    +------+-------------+
    | id   | ConditionID |
    +------+-------------+
    |    3 |         200 |
    +------+-------------+
    1 row in set (0.00 sec)
    
    SELECT * FROM Table2;
    +------+-------------+
    | id   | ConditionID |
    +------+-------------+
    |    2 |         200 |
    |    3 |         300 |
    +------+-------------+
    2 rows in set (0.00 sec)
    
    SELECT * FROM Table3;
    Empty set (0.00 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the best way to delete all rows from a table in sql but
I just did a delete from table How do I roll back or undelete
Just wondering which is faster: DELETE FROM table_name WHERE X='1' DELETE FROM table_name WHERE
If I have a query like, DELETE FROM table WHERE datetime_field < '2008-01-01 00:00:00'
Whenever we have to update the database; we delete the values from the table
I have to delete some rows from a data table. I've heard that it
I had to delete all the rows from a log table that contained about
I erroneously delete all the rows from a MS SQL 2000 table that is
I need to query a delete statement for the same table based on column
I want to delete the last row from the table that satisfies some condition.

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.