{"id":7838,"date":"2024-11-14T16:25:34","date_gmt":"2024-11-14T08:25:34","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7838\/"},"modified":"2024-11-14T16:25:34","modified_gmt":"2024-11-14T08:25:34","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-exists-%e5%85%b3%e9%94%ae%e5%ad%97%e6%a3%80%e6%9f%a5%e4%b8%a4%e4%b8%aa%e8%a1%a8%e4%b8%ad%e6%98%af%e5%90%a6%e5%ad%98%e5%9c%a8%e5%af%b9%e5%ba%94%e5%80%bc%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7838\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 EXISTS \u5173\u952e\u5b57\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u503c\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173129349123182.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 EXISTS \u5173\u952e\u5b57\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u503c\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 EXISTS \u5173\u952e\u5b57\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u503c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 exists \u5173\u952e\u5b57\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u7684\u503c\uff1f<\/strong><\/p>\n<p>\u5728  \u4e2d\uff0cexists \u5173\u952e\u5b57\u53ef\u7528\u4e8e\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u7684\u503c\u3002\u8981\u4f7f\u7528 exists \u5173\u952e\u5b57\u68c0\u67e5\u4e3b\u8868(\u7b2c\u4e00\u5f20\u8868)\u4e2d\u662f\u5426\u5b58\u5728\u5b50\u8868(\u7b2c\u4e8c\u5f20\u8868)\u4e2d\u7684\u5185\u5bb9\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u5c06\u5b50\u67e5\u8be2(\u7b2c\u4e8c\u5f20\u8868)\u4f5c\u4e3a exists \u5b50\u53e5\u7684\u53c2\u6570\u3002\u5b50\u67e5\u8be2\u5e94\u8fd4\u56de true \u6216 false\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u5b50\u8868\u4e2d\u662f\u5426\u5b58\u5728\u4e0e\u4e3b\u8868\u5339\u914d\u7684\u503c\u3002<\/li>\n<li>\u5728\u4e3b\u67e5\u8be2\u4e2d\uff0c\u4f7f\u7528 exists \u5b50\u53e5\u68c0\u67e5\u5b50\u67e5\u8be2\u662f\u5426\u8fd4\u56de true\u3002\u5982\u679c\u5b50\u67e5\u8be2\u8fd4\u56de true\uff0c\u5219 exists \u6761\u4ef6\u4e3a true\uff0c\u8868\u660e\u5728\u4e3b\u8868\u4e2d\u627e\u5230\u4e86\u5339\u914d\u7684\u503c\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0b\u662f\u60a8\u63d0\u4f9b\u7684\u67e5\u8be2\u7684\u66f4\u6b63\u7248\u672c\uff1a<\/p>\n<pre>select * from (\n    select pn_Code, serialNumber from pnassertbasic_ruku pr left join pnassertruku pu on pr.parent_pnAssertRuku_id = pu.child_pnAssertRukuDetails_id\nwhere pn_Code is not null and serialNumber is not null and DATE(pr.create_time) = CURDATE() and pr.warehouseEntryNumber &lt;&gt; 'WEd3791f0b'\n) as temp1\nwhere EXISTS (\n    select * from (\n    select pn_Code, serialNumber from pnassertbasic_ruku pr left join pnassertruku pu on pr.parent_pnAssertRuku_id = pu.child_pnAssertRukuDetails_id\nwhere pu.child_pnAssertRukuDetails_id is null and pr.warehouseEntryNumber = 'WEd3791f0b'\n    ) as temp2\n    where temp1.pn_Code = temp2.pn_Code and temp1.serialNumber = temp2.serialNumber\n)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u6211\u4fee\u6539\u4e86 exists \u5b50\u53e5\u7684\u5b50\u67e5\u8be2\uff0c\u4ee5\u4fbf\u68c0\u67e5\u4e3b\u8868\u548c\u5b50\u8868\u7684 pn_code \u548c serialnumber \u5339\u914d\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 EXISTS \u5173\u952e\u5b57\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u503c\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 exists \u5173\u952e\u5b57\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u7684\u503c\uff1f \u5728 \u4e2d\uff0cexists \u5173\u952e\u5b57\u53ef\u7528\u4e8e\u68c0\u67e5\u4e24\u4e2a\u8868\u4e2d\u662f\u5426\u5b58\u5728\u5bf9\u5e94\u7684\u503c\u3002\u8981\u4f7f\u7528 exists \u5173\u952e\u5b57\u68c0\u67e5\u4e3b\u8868(\u7b2c\u4e00\u5f20\u8868)\u4e2d\u662f\u5426\u5b58\u5728\u5b50\u8868(\u7b2c\u4e8c\u5f20\u8868)\u4e2d\u7684\u5185\u5bb9\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a \u5c06\u5b50\u67e5\u8be2(\u7b2c\u4e8c\u5f20\u8868)\u4f5c\u4e3a exists \u5b50\u53e5\u7684\u53c2\u6570\u3002\u5b50\u67e5\u8be2\u5e94\u8fd4\u56de true \u6216 false\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u5b50\u8868\u4e2d\u662f\u5426\u5b58\u5728\u4e0e\u4e3b\u8868\u5339\u914d\u7684\u503c\u3002 \u5728\u4e3b\u67e5\u8be2\u4e2d\uff0c\u4f7f\u7528 exists \u5b50\u53e5\u68c0\u67e5\u5b50\u67e5\u8be2\u662f\u5426\u8fd4\u56de true\u3002\u5982\u679c\u5b50\u67e5\u8be2\u8fd4\u56de true\uff0c\u5219 exists \u6761\u4ef6\u4e3a true\uff0c\u8868\u660e\u5728\u4e3b\u8868\u4e2d\u627e\u5230\u4e86\u5339\u914d\u7684\u503c\u3002 \u4ee5\u4e0b\u662f\u60a8\u63d0\u4f9b\u7684\u67e5\u8be2\u7684\u66f4\u6b63\u7248\u672c\uff1a select * from ( select pn_Code, serialNumber from pnassertbasic_ruku pr left join pnassertruku pu on pr.parent_pnAssertRuku_id = pu.child_pnAssertRukuDetails_id where pn_Code is not null and serialNumber is not null and DATE(pr.create_time) = CURDATE() [&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-7838","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7838","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=7838"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7838\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}