Results 1 to 2 of 2

Thread: Syntax

  1. #1
    Join Date
    Oct 2008
    Posts
    1

    Syntax

    Hi,
    I'm new to MySQL and I'm trying to make a command which will check database integrit(dead links, when a table is linked to another table which was deleted...)
    Code:
    DELETE FROM `characters` LEFT JOIN `accounts` ON `characters`.`acct`=`accounts`.`acct` WHERE `accounts`.`acct`=NULL
    Do you know where can be a problem ?
    http://forums.databasejournal.com/clear.gif
    http://forums.databasejournal.com/clear.gif
    http://forums.databasejournal.com/clear.gif
    http://forums.databasejournal.com/clear.gif
    http://forums.databasejournal.com/clear.gif
    Sorry for my English I'm czech...

  2. #2
    Join Date
    Nov 2008
    Posts
    2
    you should try this :

    Code:
    delete from characters c Where not exists(select * from accounts a where c.acct = a.acct )

Posting Permissions

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