Forum Moderators: open
'users' table:
- username password and all that good stuff
- pic int unsigned default 1
'pics' table
- id int not null auto_increment primary key,
- name varchar(30) not null,
- type varchar(30) not null,
- size int(11) not null,
- content mediumblob not null
not that i think all that matters but ... putting it there just incase
So, was thinking of doing something like :
DELETE FROM pics WHERE id != users.pic
P.S. and plz excuse my excessive attempt at detailedness ... this is my first ever forum post
Thanks in advanced
Welcome to WebmasterWorld!
Try something like this
DELETE FROM pics where id not in (select pic from users)
What it does is that the subquery will get all the 'pic' values from your users table and then the main query will delete all data from pics table where id is not in one of the values that subquery returned.
Try it on a Test Database first, i typed all the message in a rush.