var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: syntax assistance delete statement
Ok folks...try to hold back the laughter.
I've been away from MySql for a while and now find it neccesary to jump back in...so to that end...
DELETE FROM mlsdb.virtualdb LEFT JOIN mlsdb.mlstable ON (mlsdb.virtualdb.mlsnum = mlsdb.virtualdb.mlsnum)WHERE mlsdb.mlstable.ListID <> mlsdb.virtualdb.mlsnum
I have a db with 19 tables. I need to delete the records from the table "virtualdb" that do not have corresponding ID numbers in the table "mlstable"
I came up with the above...which obviously dosn't work, lol. any help would be appreciated.
Last edited by glyndower; 01-31-04 at 04:47.
DELETE mlsdb.virtualdb FROM mlsdb.virtualdb, mlsdb.mlstable
WHERE mlsdb.mlstable.ListID = mlsdb.virtualdb.mlsnum
AND mlsdb.mlstable.ListID IS NULL
this doesn't have a shot at working unless you are running
tried it anyway, but you were right...didnt work. Thanks for the suggestion though!
Then you can make a list of IDs you want to delete,
FROM mlsdb.virtualdb LEFT JOIN mlsdb.mlstable
ON mlsdb.mlstable.ListID = mlsdb.virtualdb.mlsnum
WHERE mlsdb.mlstable.ListID IS NULL
and delete 'em,
DELETE FROM mlsdb.virtualdb WHERE mlsdb.virtualdb.mlsnum
IN ( <your_list> )