Mysql Query Help

Started on the old forum in March 2009 · view the original in the archive · old links redirect here

1 reply · 379 views · started 17 years ago · 1 min read

Anshul Senior · 296 posts #1

QUOTE

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='Buddies table' 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='users' AUTO_INCREMENT=1 ;

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

Anshul Senior · 296 posts #2

close this topic now 😛

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close