Results 1 to 2 of 2
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Alzano Lombardo, Italy
    Thanked 0 Times in 0 Posts

    Delete Query Doesn't Delete (2003)

    The Query8 delete query below is supposed to eliminate the records pertaining to the last day in the various database tables
    but I get a message saying it's impossible to eliminate the specified tables. What's wrong?

    DELETE Previsioni.*, Letture.*, OreFunz.*, Personale.*, Readings.*, Varie.*
    FROM ((((Previsioni INNER JOIN Letture ON Previsioni.Giorno = Letture.Giorno) INNER JOIN OreFunz ON Letture.Giorno = OreFunz.Giorno) INNER JOIN Personale ON OreFunz.Giorno = Personale.Giorno) INNER JOIN Readings ON Personale.Giorno = Readings.Giorno) INNER JOIN Varie ON Readings.Giorno = Varie.Giorno
    WHERE (((Previsioni.Giorno)=(select max(b2.giorno) from previsioni as B2)));

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Delete Query Doesn't Delete (2003)

    You haven't defined relationships with enforced referential integrity and cascading deletes between the tables. And several tables don't have a primary key.

    In general, delete queries on more than one table are tricky. It's best to delete records from the "main" table, and let cascading deletes take care of related records in the other tables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts