{"id":7071,"date":"2024-11-14T10:13:26","date_gmt":"2024-11-14T02:13:26","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7071\/"},"modified":"2024-11-14T10:13:26","modified_gmt":"2024-11-14T02:13:26","slug":"mysql-%e4%b8%ad%e5%a6%82%e4%bd%95%e6%9f%a5%e8%af%a2%e7%89%b9%e5%ae%9a-id-%e5%bd%93%e5%a4%a9%e7%9a%84%e6%95%b0%e6%8d%ae%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7071\/","title":{"rendered":"MySQL \u4e2d\u5982\u4f55\u67e5\u8be2\u7279\u5b9a id \u5f53\u5929\u7684\u6570\u636e\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173038393293108.jpg\" class=\"aligncenter\" title=\"MySQL \u4e2d\u5982\u4f55\u67e5\u8be2\u7279\u5b9a id \u5f53\u5929\u7684\u6570\u636e\uff1f\u63d2\u56fe\" alt=\"MySQL \u4e2d\u5982\u4f55\u67e5\u8be2\u7279\u5b9a id \u5f53\u5929\u7684\u6570\u636e\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728  \u4e2d\u67e5\u8be2\u5f53\u5929\u7684\u6570\u636e<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5982\u4f55\u6839\u636e create_time \u5b57\u6bb5\uff08\u65f6\u95f4\u6233\uff09\uff0c\u67e5\u8be2 comment \u8868\u4e2d\uff0cid \u4e3a 21\uff0c\u5f53\u5929\u7684\u6240\u6709\u6570\u636e\uff1f<\/p>\n<p><strong>\u89e3\u7b54\uff1a<\/strong><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b sql \u8bed\u53e5\uff1a<\/p>\n<pre>select * from \u8868\u540d where to_days(create_time) = to_days(now()) and id = 21;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>to_days() \u51fd\u6570\u5c06\u65f6\u95f4\u6233\u8f6c\u6362\u4e3a\u65e5\u671f\u90e8\u5206\uff0c\u5ffd\u7565\u65f6\u95f4\u90e8\u5206\u3002<\/li>\n<li>to_days(now()) \u8fd4\u56de\u5f53\u524d\u65e5\u671f\u90e8\u5206\u3002<\/li>\n<li>= \u64cd\u4f5c\u7b26\u7528\u4e8e\u6bd4\u8f83\u65e5\u671f\u90e8\u5206\u3002<\/li>\n<li>and \u64cd\u4f5c\u7b26\u7528\u4e8e\u8fde\u63a5\u4e24\u4e2a\u6761\u4ef6\u3002<\/li>\n<\/ul>\n<p>\u8be5\u67e5\u8be2\u5c06\u8fd4\u56de comment \u8868\u4e2d\uff0cid \u4e3a 21\uff0c\u4e14 create_time \u5b57\u6bb5\u7684\u65e5\u671f\u90e8\u5206\u7b49\u4e8e\u5f53\u524d\u65e5\u671f\u7684\u6570\u636e\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u4e2d\u5982\u4f55\u67e5\u8be2\u7279\u5b9a id \u5f53\u5929\u7684\u6570\u636e\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\u5728 \u4e2d\u67e5\u8be2\u5f53\u5929\u7684\u6570\u636e \u95ee\u9898\uff1a \u5982\u4f55\u6839\u636e create_time \u5b57\u6bb5\uff08\u65f6\u95f4\u6233\uff09\uff0c\u67e5\u8be2 comment \u8868\u4e2d\uff0cid \u4e3a 21\uff0c\u5f53\u5929\u7684\u6240\u6709\u6570\u636e\uff1f \u89e3\u7b54\uff1a \u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b sql \u8bed\u53e5\uff1a select * from \u8868\u540d where to_days(create_time) = to_days(now()) and id = 21; \u767b\u5f55\u540e\u590d\u5236 to_days() \u51fd\u6570\u5c06\u65f6\u95f4\u6233\u8f6c\u6362\u4e3a\u65e5\u671f\u90e8\u5206\uff0c\u5ffd\u7565\u65f6\u95f4\u90e8\u5206\u3002 to_days(now()) \u8fd4\u56de\u5f53\u524d\u65e5\u671f\u90e8\u5206\u3002 = \u64cd\u4f5c\u7b26\u7528\u4e8e\u6bd4\u8f83\u65e5\u671f\u90e8\u5206\u3002 and \u64cd\u4f5c\u7b26\u7528\u4e8e\u8fde\u63a5\u4e24\u4e2a\u6761\u4ef6\u3002 \u8be5\u67e5\u8be2\u5c06\u8fd4\u56de comment \u8868\u4e2d\uff0cid \u4e3a 21\uff0c\u4e14 create_time \u5b57\u6bb5\u7684\u65e5\u671f\u90e8\u5206\u7b49\u4e8e\u5f53\u524d\u65e5\u671f\u7684\u6570\u636e\u3002 \u4ee5\u4e0a\u5c31\u662fMySQL \u4e2d\u5982\u4f55\u67e5\u8be2\u7279\u5b9a id \u5f53\u5929\u7684\u6570\u636e\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7071","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7071","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=7071"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7071\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}