Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to specify the table i want to dlelete (Access 2000)

    How to specify the table i want to delete

    I want to set up a delete query deleting all the rows where the condition students.studentid = 0 is met.However the delete query aks to specify the table
    containing the records i want to delete.The message is:
    Specify the table containing the records you want to delete.
    I cannot understand it.Can somebody help me?
    My query is the folllowing :
    DELETE [students].[studentID]
    FROM students INNER JOIN students1 ON
    [students].[studentID]=[students1].[studentID]
    WHERE ((([students].[studentID])=0));

    I have the same problems with another database, where the tables are orders an order1.
    Obviously i commit somewhere a grave mistake about my delete queries

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to specify the table i want to dlelete (Access 2000)

    I don't see anything wrong with the syntax of the query, but I don't understand why you need a join if you want to delete the record from Students for which Students.StudentID = 0. What does Students1 have to do with it?

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How to specify the table i want to dlelete (Access 2000)

    Try

    DELETE DISTINCTROW students.*
    FROM students WHERE ((([students].[studentID])=0));

    Like Hans, I see no reason for joining the students1 table at all. Your original SQL specifies a field to delete, but you really want to delete a record.
    Charlotte

Posting Permissions

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