{"id":552035,"date":"2022-01-27T02:56:02","date_gmt":"2022-01-26T18:56:02","guid":{"rendered":"http:\/\/4563.org\/?p=552035"},"modified":"2022-01-27T02:56:02","modified_gmt":"2022-01-26T18:56:02","slug":"mysql-%e6%9f%a5%e8%af%a2%ef%bc%8c%e8%83%bd%e5%90%a6%e5%81%9a%e5%88%b0%e5%bd%93%e6%9f%90%e5%ad%97%e6%ae%b5%e4%b8%ba%e7%89%b9%e5%ae%9a%e5%80%bc%e6%97%b6%ef%bc%8c%e8%af%a5%e6%9d%a1%e4%bb%b6%e5%ad%97","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=552035","title":{"rendered":"MySQL \u67e5\u8be2\uff0c\u80fd\u5426\u505a\u5230\u5f53\u67d0\u5b57\u6bb5\u4e3a\u7279\u5b9a\u503c\u65f6\uff0c\u8be5\u6761\u4ef6\u5b57\u6bb5\u4e0d\u8d77\u4f5c\u7528"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1> MySQL \u67e5\u8be2\uff0c\u80fd\u5426\u505a\u5230\u5f53\u67d0\u5b57\u6bb5\u4e3a\u7279\u5b9a\u503c\u65f6\uff0c\u8be5\u6761\u4ef6\u5b57\u6bb5\u4e0d\u8d77\u4f5c\u7528 <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lixyz <\/span>  <span><i><\/i> 23<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6807\u9898\u63cf\u8ff0\u7684\u4e0d\u592a\u6e05\u695a\uff0c\u6211\u4e3e\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<p>\u6570\u636e\u5e93 Bill \u6709\u5982\u4e0b\u5b57\u6bb5 createTime\uff1a\u521b\u5efa\u65f6\u95f4 billName\uff1a\u8d26\u5355\u540d\u79f0 billCategory\uff1a\u8d26\u5355\u5206\u7c7b billAccount\uff1a\u8d26\u5355\u8d26\u6237 \u7b49\u7b49<\/p>\n<p>\u7136\u540e\u524d\u7aef\u901a\u8fc7\u4e0b\u62c9\u83dc\u5355\u4f1a\u6709\u5982\u4e0b\u7b5b\u9009\uff1a \u5f00\u59cb\u65f6\u95f4\uff0c\u7ed3\u675f\u65f6\u95f4\uff0c\u8d26\u5355\u5206\u7c7b\uff0c\u8d26\u5355\u8d26\u6237\uff0c\u7b49\u7b49<\/p>\n<p>\u5982\u679c\u524d\u6bb5\u5bf9\u6bcf\u4e2a\u6761\u4ef6\u90fd\u8bbe\u7f6e\u503c\u7684\u8bdd\uff0c\u540e\u53f0\u6570\u636e\u5e93\u67e5\u8be2\u5f88\u5bb9\u6613<\/p>\n<p>\u4f46\u5047\u5982\u8bf4 [\u8d26\u5355\u5206\u7c7b] \u524d\u53f0\u5e76\u6ca1\u6709\u901a\u8fc7\u4e0b\u62c9\u83dc\u5355\u8fdb\u884c\u9009\u62e9\uff0c\u800c\u662f\u9009\u62e9\u4e86\u9ed8\u8ba4\uff0c\u4f1a\u5411\u540e\u53f0\u4f20\u9012\u4e00\u4e2a -1 \u503c<\/p>\n<p>\u8fd9\u4e2a\u65f6\u5019\u540e\u53f0\u7684\u67e5\u8be2\u8bed\u53e5\u8be5\u600e\u4e48\u5199\u554a<\/p>\n<p>\u56e0\u4e3a\u6761\u4ef6\u5b57\u6bb5\u6709\u82e5\u5e72\u4e2a\uff0c\u5982\u679c\u4e0d\u9009\u62e9\u7684\u8bdd\u90fd\u4f1a\u8fd4\u56de\u4e00\u4e2a\u9ed8\u8ba4\u7279\u5b9a\u503c\uff0c\u4f46\u6761\u4ef6\u6709\u633a\u591a\u7684\uff0c\u4f1a\u6709\u82e5\u5e72\u4e2a\u7ec4\u5408\uff0c\u6240\u4ee5\u5c31\u60f3\u8bf7\u95ee\uff0cMYSQL \u6709\u6ca1\u6709\u7c7b\u4f3c\u7684\u8bed\u53e5\uff0c\u5c31\u662f\u5f53 where \u79cd\u67d0\u4e2a\u6761\u4ef6\u7b49\u4e8e\u67d0\u4e2a\u503c\u65f6\uff0c\u8fd9\u4e2a\u6761\u4ef6\u5c31\u4e0d\u8d77\u4f5c\u7528 -_-  <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>11<\/span>) <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"7193566\" 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>\n<p>\u6211\u76ee\u524d\u60f3\u5230\u7684\u65b9\u6cd5\u662f\u5148\u5728\u540e\u53f0\u628a\u6240\u6709\u7684\u6570\u636e\u5168\u67e5\u51fa\u6765\uff0c\u7136\u540e\u518d\u6839\u636e\u4f20\u9012\u8fc7\u6765\u7684\u6570\u636e\u7b5b\u9009\uff0c\u4f46\u597d\u50cf\u8fd9\u4e2a\u65b9\u6cd5\u6709\u70b9\u7b28<\/p>\n<p>\u4e00\u76f4\u5199 android \uff0c\u5b8c\u5168\u662f\u8d76\u9e2d\u5b50\u4e0a\u67b6\uff0c\u6c42\u5927\u4f6c<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193567\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ltltfuture <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u524d\u7aef\u4f20\u8fc7\u6765\u7684\u53c2\u6570\u4f60\u4e0d\u8981\u76f4\u63a5\u7528\uff0c\u8fc7\u6ee4\u548c\u5224\u65ad\uff0c\u628a -1 \u7684\u8fc7\u6ee4\u6389 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193568\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aragakiyuii <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u770b\u770b\u6211\u8fd9\u7406\u89e3\u7684\u5bf9\u4e0d\u5bf9<br \/>\u6bd4\u5982\u4f60\u8981\u5199<br \/>SELECT createTime, billName, billCategory, billAccount<br \/>FROM Bill<br \/>\u540e\u9762\u52a0\u4e0a<br \/>WHERE<br \/>(billCategory &lt;&gt; -1 or billCategory=\u201c\u4f60\u4f20\u5165\u7684\u53c2\u6570\u201d )<br \/>AND<br \/>\u540e\u9762\u4f9d\u6b21\u52a0\u4e0a\u5176\u4ed6\u5217&#8230; <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193569\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : thetbw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4ee3\u7801\u91cc\u628a -1 \u8fc7\u6ee4\u6389\u4e0d\u5c31\u884c\u4e86\u2026 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193570\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dream4ever <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u8fd9\u90e8\u5c31\u662f mybatis \u7684 if \u5417<br \/>&lt;if test=&#8221;billCategory!= null and billCategory!=-1&#8243;&gt;<br \/>and bill_category = #{billCategory}<br \/>&lt;\/if&gt; <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193571\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : onhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u6700\u539f\u59cb\u7684\u65b9\u5f0f\uff0c\u5c31\u662f\u624b\u52a8\u62fc\u88c5 SQL \u8bed\u53e5\u561b\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193572\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : raptor <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div>  \u4e3b\u770b\u6765\u662f\u4e0d\u60f3\u5728\u7a0b\u5e8f\u91cc\u5904\u7406\uff0c \u76f4\u63a5\u5728 mysql \u91cc\u54af\uff0c \u90a3\u4e48\u6211\u8fd9\u91cc\u6709\u4e00\u4e2a\u529e\u6cd5\u4e0d\u77e5\u4e3b\u6562\u4e0d\u6562\u7528\uff01 <br \/>https:\/\/wuhao.pw\/archives\/268\/<br \/>\u8fd9\u65b9\u6cd5\u53ef\u80fd\u4e89\u8bae\u5f88\u5927\u7684 \uff0c \u7528\u51fd\u6570\u6765\u5b9e\u73b0\uff0c\u81ea\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570 \u6765\u5904\u7406\u8fd9\u4e2a\u7279\u5b9a\u503c\u3002^_^ <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193573\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Tenlearn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> SELECT createTime, billName, billCategory, billAccount<br \/>FROM Bill<br \/>WHERE<br \/>(:billCategory = -1 or billCategory=:billCategory)<br \/>\u7136\u540e\u628a\u8f93\u5165\u503c\u4f20\u7ed9:billCategory \u8fd9\u4e2a\u53c2\u6570\u5373\u53ef\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193574\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 2i2Re2PLMaDnghL <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> @onhao \u6562\u7528\uff0c\u6708\u5e95\u5c31\u9886\u5de5\u8d44\u8d70\u4e86\uff0c\u5f88\u5b89\u8be6 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193575\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gesse <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u5982\u679c\u4f20\u53c2\u53ef\u4ee5\u6709\u5e8f\u53c2\u6570\u5316\u7684\u8bdd<br \/>WHERE ?1&lt;&gt;-1 OR billCategory=?1<br \/>\u5982\u679c\u4e0d\u80fd\u7684\u8bdd<br \/>WHERE ?&lt;&gt;-1 OR billCategory=? \u5e76\u4e14\u628a\u8fd9\u4e2a\u53c2\u6570\u4f20\u4e24\u904d\uff0c\u5c31\u4f1a\u53d8\u6210 query(sql, a, a, b, b, c, c, d, d) \u8fd9\u6837\u7684\u7ed3\u6784\uff08\u4f60\u4e5f\u53ef\u4ee5\u518d\u5c01\u88c5\u4e00\u4e0b\uff09<br \/>\u5bf9\u4e8e\u6052 true \u6216\u8005\u6052 false \u7684\u6761\u4ef6\uff0cSQL \u4f1a\u5728\u7f16\u8bd1\u671f\u76f4\u63a5\u4f18\u5316\u6389\u3002 <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"7193576\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : <a href=\"http:\/\/machbbs.com\/user-2.htm\"><\/a> <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>  <\/span> <\/div>\n<\/p><\/div>\n<div> \u4f60\u4e2a\u4eba\u50cf\u4e8b\u60c5\u903b\u8f91\u6709\u70b9\u95ee\u9898 <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u67e5\u8be2\uff0c\u80fd\u5426\u505a\u5230\u5f53\u67d0\u5b57\u6bb5&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/552035"}],"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=552035"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/552035\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=552035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=552035"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=552035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}