Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete Query (XP)

    Hi, I think I must be doing something really stupidly wrong, because I can't seem to delete a list of records using a simple query.

    Setup is:

    Table A. Fields: username, SSO
    Table B. Fields: SSO,x,y,z,....

    My query looks for all records in Table A that have NO SSO entry in table B.

    It finds these records fine. Then when I try to delete them, it does not remove the records from table A, just deletes them from the query table, but when I run the query again they come back up.

    When I try and create a DELETE query I can't get it to work either. Is this something that cant be done or am I missing a simple point?

    Cheers
    Thanks,

    pmatz

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

    Re: Delete Query (XP)

    Deleting requires that the query is updateable, and this depends on the indexes on the join fields. You can use a subquery for this:

    SELECT *
    FROM <!t>[Table A]
    WHERE SSO Not In (SELECT SSO FROM <!t>[Table B])

    If you replace the first SELECT with DELETE you have a delete query.

  3. #3
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Query (XP)

    Ah of course! Thanks )

    This was the culprit:
    Attached Images Attached Images
    Thanks,

    pmatz

Posting Permissions

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