Results 1 to 9 of 9

Thread: MySQL Delete, checking against temp. table

Threaded View

  1. #1
    Senior Member
    Join Date
    Apr 2004
    Posts
    228

    MySQL Delete, checking against temp. table

    Hi guys

    One more little thing I can't work out

    I need to delete the records from the table 'server_error_reasons', but it should be done only in the case if these servers do not appear in the temporary table 'temp_sunward_audit'

    the original query was:

    delete from server_error_reasons
    where
    server_error_reasons.hostid != all (select hostid from temp_sunward_audit)
    and
    server_error_reasons.hostname != all (select hostname from temp_sunward_audit);


    Now this one produces an error as it is calling on to the temp. table twice.

    At the moment, after some more research in to the subject I got the next query:

    delete server_error_reasons
    from server_error_reasons, temp_sunward_audit
    where
    temp_sunward_audit.hostid != server_error_reasons.hostid
    and
    temp_sunward_audit.hostname != server_error_reasons.hostname;

    and a couple of it's variations.

    Yet the query in it's present form deletes all the records from the 'server_error_resons' table.

    I understand that it has something to do with the way I join tables, yet it seems that I am not quite grasping the concept of joints correctly.

    Thanks for all your answers in advance
    Last edited by nightcat; December 18th, 2006 at 12:38 PM.
    Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying

Posting Permissions

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