Delete all entries that have a certain field
I have a database table that has 4 fields. It is created like this:
CREATE TABLE meta (
meta_id bigint(20) NOT NULL auto_increment,
object_id bigint(20) NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (`meta_id`),
KEY `object_id` (`object_id`),
KEY `meta_key` (`meta_key`)
)
How can I delete all entries from this table, that have a certain meta_ke开发者_开发技巧y
, for eg. foo
?
Something like this?
DELETE FROM meta WHERE meta_key = 'foo'
delete from meta where meta_key='foo'
Am i missing something??
the query would be:
DELETE FROM meta WHERE meta_key = "foo";
精彩评论