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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:53:57+00:00 2026-06-09T00:53:57+00:00

I need to delete from two tables, based on a query in one table

  • 0

I need to delete from two tables, based on a query in one table

Table: entities
guid: integer
subtype: integer
time_created: integer (Unix timestamp)

Table: objects_entity
guid: integer
title: text

guid in objects_entity is a foreign key to entities.guid

I need to delete related records in both tables based on subtype=17 and time_created is older than 14 days in entities (so also delete related objects_entity)

I’m very bad at SQL and by looking at examples I’ve created this:

DELETE entities, objects_entity FROM entities a INNER JOIN objects_entity b on b.guid = a.guid AND a.subtype =17 AND a.time_created < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 14 DAY))

but this gives the error:

#1109 - Unknown table 'entities' in MULTI DELETE

which is beyond me, as a select statement identical to above works correctly…. The table exists.

Any ideas what’s wrong with my syntax? Many 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-09T00:54:00+00:00Added an answer on June 9, 2026 at 12:54 am

    You need to replace

    DELETE entities, objects_entity
    

    with

    DELETE a, b
    

    since you are aliasing your tables with a and b.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to delete entries from a table based on a key, and these
I use the following query, to delete the rows from two tables delete itc,
I need to delete some rows from a table, based on a mixed where
I need to delete rows in a table, such as DELETE FROM TABLE_X WHERE
I need to delete a few fields from the table in the database. I
The folder I need to delete is one that is created from my program.
I have two tables as students and certificates, I need to delete the certificates
I need to create a join that will delete the entries in two tables.
I have two tables, I need all rows from the first that don't appear
I have two tables: CREATE TABLE items ( root_id integer NOT NULL, id serial

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.