{"id":200956,"date":"2025-05-06T14:25:55","date_gmt":"2025-05-06T06:25:55","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200956\/"},"modified":"2025-05-06T14:25:55","modified_gmt":"2025-05-06T06:25:55","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88-mysql-%e7%9a%84-where-%e5%ad%90%e5%8f%a5%e4%b8%ad%e5%b8%83%e5%b0%94%e5%80%bc%e5%ad%97%e6%ae%b5%e6%af%94%e8%be%83%e8%a6%81%e7%94%a8%e5%ad%97%e7%ac%a6%e4%b8%b2%e8%80%8c","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200956\/","title":{"rendered":"\u4e3a\u4ec0\u4e48 MySQL \u7684 WHERE \u5b50\u53e5\u4e2d\u5e03\u5c14\u503c\u5b57\u6bb5\u6bd4\u8f83\u8981\u7528\u5b57\u7b26\u4e32\u800c\u4e0d\u662f\u6570\u5b57\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u4e3a\u4ec0\u4e48 MySQL \u7684 WHERE \u5b50\u53e5\u4e2d\u5e03\u5c14\u503c\u5b57\u6bb5\u6bd4\u8f83\u8981\u7528\u5b57\u7b26\u4e32\u800c\u4e0d\u662f\u6570\u5b57\uff1f<\/h1>\n<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300a\u4e3a\u4ec0\u4e48 MySQL \u7684 WHERE \u5b50\u53e5\u4e2d\u5e03\u5c14\u503c\u5b57\u6bb5\u6bd4\u8f83\u8981\u7528\u5b57\u7b26\u4e32\u800c\u4e0d\u662f\u6570\u5b57\uff1f\u300b\uff0c\u8986\u76d6\u4e86\u6570\u636e\u5e93\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241123\/17323315666741482e57648.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u4e3a\u4ec0\u4e48 mysql \u7684 where \u4e4b\u95f4\u65e0\u6cd5\u4f7f\u7528 = \u68c0\u7d22\u5e03\u5c14\u503c\uff1f<\/strong><\/p>\n<p>\u5728 mysql \u4e2d\uff0cwhere \u5b50\u53e5\u4e2d\u5e03\u5c14\u503c\u5b57\u6bb5\u7684\u6bd4\u8f83\u5fc5\u987b\u4f7f\u7528\u5b57\u7b26\u4e32\u800c\u4e0d\u662f\u6570\u5b57\u3002\u8fd9\u662f\u56e0\u4e3a enum \u503c\uff08\u5e03\u5c14\u503c\u7c7b\u578b\u4f5c\u4e3a enum \u503c\u5b58\u50a8\uff09\u7684\u7d22\u5f15\u662f\u4ece 1 \u5f00\u59cb\u7684\uff0c\u800c\u4e0d\u662f\u4ece 0 \u5f00\u59cb\u7684\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5728\u60a8\u63d0\u4f9b\u7684\u8868\u7ed3\u6784\u4e2d\uff0cis_svddb_match \u5b57\u6bb5\u662f\u4f7f\u7528 &#8216;true&#8217;\uff081\uff09\u548c &#8216;false&#8217;\uff080\uff09\u503c\u7684 enum \u7c7b\u578b\uff1a<\/p>\n<pre>create table `tmp_rt57517_20230407` (\n  `video_id` int(10) unsigned not null,\n  `key_id` varchar(64) not null comment 'key id from tracking website',\n  `trackingwebsite_id` smallint(5) unsigned not null comment 'tracking website id',\n  `is_svddb` enum('true','false') not null default 'true' comment 'filter meta by release date',\n  `is_svddb_match` enum('true','false') not null default 'true' comment 'filter meta by release date',\n  `match_count` int(11) default null comment '\u5339\u914d\u5230\u51e0\u4e2a\u6bcd\u672c',\n  primary key (`video_id`)\n) engine=innodb default charset=latin1<\/pre>\n<p>\u5f53\u60a8\u4f7f\u7528 where \u5b50\u53e5\u6bd4\u8f83\u5e03\u5c14\u503c\u5b57\u6bb5\u65f6\uff0c\u5fc5\u987b\u4f7f\u7528\u76f8\u5e94\u7684\u5b57\u7b26\u4e32\u503c\u3002\u56e0\u6b64\uff0c\u8981\u68c0\u7d22\u6240\u6709 is_svddb_match \u503c\u4e3a false \u7684\u884c\uff0c\u60a8\u9700\u8981\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\uff1a<\/p>\n<pre>SELECT * FROM `tmp_rt57517_20230407` WHERE `is_svddb_match` = 'false';<\/pre>\n<p>\u4f7f\u7528\u6570\u5b57\u503c\uff08\u4f8b\u5982 where is_svddb_match = 0\uff09\u5c06\u4e0d\u4f1a\u8fd4\u56de\u4efb\u4f55\u7ed3\u679c\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300a\u4e3a\u4ec0\u4e48 MySQL \u7684 WHERE \u5b50\u53e5\u4e2d\u5e03\u5c14\u503c\u5b57\u6bb5\u6bd4\u8f83\u8981\u7528\u5b57\u7b26\u4e32\u800c\u4e0d\u662f\u6570\u5b57\uff1f\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6570\u636e\u5e93\u77e5\u8bc6\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48 MySQL \u7684 WHER&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200956","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200956"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200956\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}