{"id":45394,"date":"2024-12-01T09:44:36","date_gmt":"2024-12-01T01:44:36","guid":{"rendered":"https:\/\/fwq.ai\/blog\/45394\/"},"modified":"2024-12-01T09:44:36","modified_gmt":"2024-12-01T01:44:36","slug":"mysql%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%8f%82%e6%95%b0%e6%8a%a5%e9%94%99%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bc%a0%e5%85%a5%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%8f%82-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/45394\/","title":{"rendered":"MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f<\/h1>\n<p>\u5927\u5bb6\u597d\uff0c\u4eca\u5929\u672c\u4eba\u7ed9\u5927\u5bb6\u5e26\u6765\u6587\u7ae0\uff0c\u6587\u4e2d\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230\uff0c\u5982\u679c\u4f60\u5bf9\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u90a3\u5c31\u8bf7\u5404\u4f4d\u670b\u53cb\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427~\u5e0c\u671b\u80fd\u771f\u6b63\u5e2e\u5230\u4f60\u4eec\uff0c\u8c22\u8c22\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241110\/173122436867306330c1113.jpg\" class=\"aligncenter\" title=\"MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f\u63d2\u56fe\" alt=\"MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>mysql \u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\u5206\u6790<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5728\u8c03\u7528 mysql \u5b58\u50a8\u8fc7\u7a0b\u65f6\uff0c\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u51fa\u73b0\u201cunknown column\u201d\u9519\u8bef\u3002\u800c\u4f20\u5165\u6574\u578b\u53c2\u6570\u65f6\uff0c\u5b58\u50a8\u8fc7\u7a0b\u8fd0\u884c\u6b63\u5e38\u3002<\/p>\n<p><strong>\u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\uff1a<\/strong><\/p>\n<pre>create procedure mypo02(in dataname varchar(10))\nbegin\n  if dataname is null or dataname = \"\" then\n      select * from ssd;\n  else\n      select * from ssd where ename like concat('%',dataname,'%');\n  end if;\nend;<\/pre>\n<p><strong>\u9519\u8bef\u4fe1\u606f\uff1a<\/strong><\/p>\n<pre>Procedure execution failed\n1054 - Unknown column '\u738b\u5c0f\u674e' in 'field list'<\/pre>\n<p><strong>\u5206\u6790\uff1a<\/strong><\/p>\n<p>\u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\u672c\u8eab\u5e76\u6ca1\u6709\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u95ee\u9898\u53ef\u80fd\u51fa\u5728\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u65f6\u3002\u5e38\u89c1\u7684\u539f\u56e0\u53ef\u80fd\u662f\uff1a<\/p>\n<ul>\n<li>\u8c03\u7528\u4ee3\u7801\u4e2d\u4f20\u5165\u7684\u53c2\u6570\u7c7b\u578b\u4e0d\u6b63\u786e\uff0c\u5bfc\u81f4\u5b9e\u9645\u4f20\u5165\u7684\u662f\u5b57\u7b26\u4e32\uff0c\u800c\u5b58\u50a8\u8fc7\u7a0b\u671f\u671b\u7684\u662f\u6574\u578b\u3002<\/li>\n<li>\u5728\u5b58\u50a8\u8fc7\u7a0b\u8c03\u7528\u4e4b\u524d\uff0c\u6ca1\u6709\u5bf9\u4f20\u5165\u53c2\u6570\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\uff0c\u5bfc\u81f4\u5b57\u7b26\u4e32\u53c2\u6570\u76f4\u63a5\u88ab\u89e3\u91ca\u4e3a\u5217\u540d\uff0c\u800c\u4e0d\u662f\u4f5c\u4e3a\u6bd4\u8f83\u503c\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6570\u636e\u5e93\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f \u5927\u5bb6\u597d\uff0c\u4eca\u5929\u672c\u4eba\u7ed9\u5927\u5bb6\u5e26\u6765\u6587\u7ae0\uff0c\u6587\u4e2d\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230\uff0c\u5982\u679c\u4f60\u5bf9\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u90a3\u5c31\u8bf7\u5404\u4f4d\u670b\u53cb\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427~\u5e0c\u671b\u80fd\u771f\u6b63\u5e2e\u5230\u4f60\u4eec\uff0c\u8c22\u8c22\uff01 mysql \u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\u5206\u6790 \u95ee\u9898\uff1a \u5728\u8c03\u7528 mysql \u5b58\u50a8\u8fc7\u7a0b\u65f6\uff0c\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u51fa\u73b0\u201cunknown column\u201d\u9519\u8bef\u3002\u800c\u4f20\u5165\u6574\u578b\u53c2\u6570\u65f6\uff0c\u5b58\u50a8\u8fc7\u7a0b\u8fd0\u884c\u6b63\u5e38\u3002 \u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\uff1a create procedure mypo02(in dataname varchar(10)) begin if dataname is null or dataname = &#8220;&#8221; then select * from ssd; else select * from ssd where ename like concat(&#8216;%&#8217;,dataname,&#8217;%&#8217;); end if; end; \u9519\u8bef\u4fe1\u606f\uff1a Procedure execution failed 1054 &#8211; Unknown column &#8216;\u738b\u5c0f\u674e&#8217; in &#8216;field list&#8217; \u5206\u6790\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-45394","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/45394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=45394"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/45394\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=45394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=45394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=45394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}