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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:48:32+00:00 2026-06-09T23:48:32+00:00

Below query gives me #1093 – You can’t specify target table ‘reservation_seats’ for update

  • 0

Below query gives me “#1093 – You can’t specify target table ‘reservation_seats’ for update in FROM clause” error.

DELETE 
FROM reservation_seats 
WHERE id IN ( SELECT id 
              FROM reservation_seats 
              WHERE reservation_id NOT IN ( SELECT id FROM reservation)
            );

Table Structure :

reservation_seats - id,reservation_id,seat_no
reservation       - id,txn_id,name......
reservation table(id) column is used as the foreign in the reservation_seats table.
(reservation.id = reservation_seats.reservation_id )

Can you please tell me why is that and how to fix it?

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-09T23:48:33+00:00Added an answer on June 9, 2026 at 11:48 pm

    In MySQL you can’t delete from the table you are selecting from. Try

    DELETE FROM reservation_seats
    WHERE id IN ( 
                  select * from 
                  (
                       SELECT id FROM reservation_seats
                       WHERE reservation_id NOT IN ( SELECT id FROM reservation)
                  )
    );
    

    to trick MySQL to do it anyway. BTW this could be made simpler like this

    DELETE FROM reservation_seats
    WHERE reservation_id NOT IN ( SELECT id FROM reservation)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query select CONVERT(varchar(5), tdate ,108) AS [Time] from table which gives
How can I execute the results of my select query. The query below gives
Why does the MySQL query below give error 1066 (Not unique table/alias: 'customer') ?
I have the below query in a postgresql database SELECT * FROM accounts where
I run the below query..... SELECT SUM(PAPostedTotalCostN) AS Total_Cost FROM PA01201 WHERE PA01201.PAcontid =
What does the below query explain? SELECT * FROM `jos_menu` WHERE (id = 69
How do I specify a date range in MS Access? Is the below query
I have tried the below query: select empno from ( select empno from emp
In the query below, I am trying to use the first table in a
I want to fire below query on tm_matrix but gives me following error mysql>

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.