开发者

Delete all entries that have a certain field

开发者 https://www.devze.com 2023-02-11 18:11 出处:网络
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,

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";
0

精彩评论

暂无评论...
验证码 换一张
取 消