• Delete Query (XP)

    Author
    Topic
    #457617

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1147922

      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 [Table A]
      WHERE SSO Not In (SELECT SSO FROM [Table B])

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

      • #1147924

        Ah of course! Thanks )

        This was the culprit:

    Viewing 0 reply threads
    Reply To: Delete Query (XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: