{"id":280215,"date":"2021-01-14T03:49:05","date_gmt":"2021-01-13T19:49:05","guid":{"rendered":"http:\/\/4563.org\/?p=280215"},"modified":"2021-01-14T03:49:05","modified_gmt":"2021-01-13T19:49:05","slug":"mysql-like-%e9%97%ae%e9%a2%98%e6%b1%82%e6%95%99","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=280215","title":{"rendered":"mysql like \u95ee\u9898\u6c42\u6559"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  mysql like \u95ee\u9898\u6c42\u6559               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lixuda <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u5728\u770b discuz \u65f6\u5019\uff0c\u53d1\u73b0\u641c\u7d22\u5e16\u5b50\u65f6\u5019<\/p>\n<p>1 \u4e2a\u5173\u952e\u8bcd<br \/>SELECT t.tid, t.closed, t.author, t.authorid FROM pre_forum_thread t WHERE t.fid IN (&#8216;2&#8242;,&#8217;36&#8217;,&#8217;37&#8217;,&#8217;4&#8242;,&#8217;39&#8217;) AND t.displayorder&gt;=&#8217;0&#8242; AND (0 OR t.subject LIKE &#8216;%key%&#8217;) ORDER BY tid DESC LIMIT 500<\/p>\n<p>\u591a\u4e2a\u5173\u952e\u8bcd\uff1a<\/p>\n<p>SELECT t.tid, t.closed, t.author, t.authorid FROM pre_forum_thread t WHERE t.fid IN (&#8216;2&#8242;,&#8217;36&#8217;,&#8217;37&#8217;,&#8217;4&#8242;,&#8217;39&#8217;) AND t.displayorder&gt;=&#8217;0&#8242; AND (1 AND t.subject LIKE &#8216;%key%&#8217; AND t.subject LIKE &#8216;%key1%&#8217;) ORDER BY tid DESC LIMIT 500<\/p>\n<p>\u5c31\u662f 0 OR \u4e0e 1 AND \u94fe\u63a5 like\uff0c\u8fd9\u4e2a\u6709\u4ec0\u4e48\u7528\u5904\u5417\uff1f<br \/>\u662f\u9632\u6b62 SQL \u6ce8\u5165\u5417\uff1f      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4940979\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : eason1874 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u662f\u5b89\u5168\u8003\u8651\uff0c\u5c31\u662f\u4e3a\u4e86\u65b9\u4fbf\uff0c\u6ca1\u67e5\u8be2\u4ef7\u503c\u7684\uff0c\u67e5\u8be2\u7684\u65f6\u5019\u4f1a\u88ab\u4f18\u5316\u6389\u3002<\/p>\n<p>\u5176\u4e2d\u4e00\u4e2a\u6761\u4ef6\u4e3a\u771f\uff0c\u90a3\u5c31\u6574\u4e2a\u524d\u7f00 where 0\uff0c\u540e\u9762\u6240\u6709\u8ffd\u52a0\u76f4\u63a5 OR condition \u5c31\u884c\u4e86\uff0c\u4e0d\u7528\u5224\u65ad\u662f\u4e0d\u662f\u7b2c\u4e00\u4e2a\uff0c\u8981\u4e0d\u8981\u5199 OR <\/p>\n<p>\u6240\u6709\u6761\u4ef6\u4e3a\u771f\u5c31\u6574\u4e2a\u524d\u7f00 where 1\uff0c\u540e\u9762\u8ffd\u52a0\u76f4\u63a5 AND condition                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4940980\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : taogen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u80fd\u662f\u65b9\u4fbf\u52a8\u6001\u62fc\u63a5 SQL                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4940981\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : msg7086 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f53\u5e74\u8fd8\u6ca1\u6709\u5404\u79cd ORM\uff0c\u6240\u4ee5\u8981\u590d\u6742\u7684\u68c0\u7d22\u67e5\u8be2\u5c31\u9700\u8981\u624b\u62fc\u67e5\u8be2\u5b57\u7b26\u4e32\u3002<br \/>\u5c31\u50cf\u4e0a\u9762\u8bf4\u7684\uff0c\u5148\u653e\u4e00\u4e2a &#8220;1&#8221;\uff0c\u7136\u540e\u540e\u9762\u6bcf\u6b21\u8ffd\u52a0 &#8220;AND xxx LIKE xxx&#8221;\uff0c\u6bd4\u5408\u5e76\u6761\u4ef6\u7136\u540e\u518d\u53bb\u5220\u6389\u4e00\u4e2a AND \u65b9\u4fbf\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4940982\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sodadev <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3b\u8981\u662f\u61d2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>mysql like \u95ee\u9898\u6c42\u6559 \u8cc7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/280215"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=280215"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/280215\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280215"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}