Mysql Query Help

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Mysql Query Help

    <div class='quotetop'>QUOTE </div>
    CREATE TABLE `buddies` (
    `id` int(11) NOT NULL auto_increment,
    `buddy1` int(11) NOT NULL,
    `buddy2` int(11) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=&#39;Buddies table&#39; AUTO_INCREMENT=1 ;


    CREATE TABLE IF NOT EXISTS `users` (
    `id` int(11) NOT NULL auto_increment,
    `login` varchar(30) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `login` (`login`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=&#39;users&#39; AUTO_INCREMENT=1 ;[/b]
    Suppose i have these two tables. in buddies table buddy1 or buddy2 is the ID of users table . I want a query that will delete the buddies ID if buddy1 or buddy2 doesnt not exist in users table

    #2
    close this topic now :P

    Comment

    Working...
    X