{"id":158784,"date":"2020-09-15T07:20:43","date_gmt":"2020-09-14T23:20:43","guid":{"rendered":"http:\/\/4563.org\/?p=158784"},"modified":"2020-09-15T07:20:43","modified_gmt":"2020-09-14T23:20:43","slug":"mysql-%e7%9a%84-select%ef%bc%8c%e5%a6%82%e4%bd%95%e8%ae%a9%e5%88%86%e9%92%9f%e6%88%96%e8%80%85%e7%a7%92%e6%95%b0%e6%9d%a5%e5%81%9a-where-%e6%9d%a1%e4%bb%b6%e5%91%a2%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=158784","title":{"rendered":"MySQL \u7684 SELECT\uff0c\u5982\u4f55\u8ba9\u5206\u949f\u6216\u8005\u79d2\u6570\u6765\u505a WHERE \u6761\u4ef6\u5462\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  MySQL \u7684 SELECT\uff0c\u5982\u4f55\u8ba9\u5206\u949f\u6216\u8005\u79d2\u6570\u6765\u505a WHERE \u6761\u4ef6\u5462\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : uti6770werty <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>InSerttTime \u5b57\u6bb5\u662f datetime \u7c7b\u578b<br \/> \u6bd4\u5982\uff0c\u8981 SELECT \u51fa InSerttTime \u5b57\u6bb5\u662f&#8221;2020-03-15 XX:43:XX&#8221;,\u8981\u627e\u51fa\u5f53\u5929 43 \u5206\u7684\u6240\u6709\u5b57\u6bb5\u5185\u5bb9<br \/> \u5982\u679c\u662f\u6307\u5b9a\u65f6\u3001\u79d2\uff0c\u800c\u4e0d\u6307\u5b9a\u65e5\u671f\u5462\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3406568\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zvcs <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             &#8230; where minute \uff08 InSerttTime \uff09=\u20184\u2019                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3406569\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : coderteddy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709 format \u4e0d\u4f1a\u7528\u5417\uff0c\u5144\u5f1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3406570\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dovme <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             http:\/\/tool.mkblog.cn\/lmbtfy\/?q=TXlTUUwg5qC55o2u5pe26Ze05oiz5p+l6K+i5pWw5o2u                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3406571\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aguesuka <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728\u610f\u6027\u80fd\u5c31\u5355\u72ec\u4e00\u4e2a\u5b57\u6bb5\u5b58\u3002<br \/>\u4e0d\u5728\u610f\u5c31\u8f6c\u5b57\u7b26\u4e32\u6bd4\u8f83                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3406572\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : oneisall8955 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dovme \u6709\u70b9\u4e1c\u897f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3406573\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : virusdefender <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/date-and-time-functions.html#function_extract<\/p>\n<p>mysql&gt; SELECT EXTRACT(DAY_MINUTE FROM &#8216;2019-07-02 01:02:03&#8217;);<br \/> -&gt; 20102                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3406574\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ccalywm <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             select InSerttTime from table where InSerttTime regexp &#8216;2020-03-15 XX:43:&#8217;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3406575\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : CodeCodeStudy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148 SELECT id FROM table_name WHERE InSerttTime &gt;= &#8216;2020-03-15&#8217; AND InSerttTime &lt; &#8216;2020-03-16&#8217;;<br \/>\u5f97\u5230\u6240\u6709\u7b26\u5408\u6761\u4ef6\u7684\u4e3b\u952e id\uff0c\u5047\u8bbe\u5f97\u5230\u7684\u662f 1,2,3\uff0c\u7136\u540e\u518d<br \/>SELECT * FROM table_name WHERE id IN (1,2,3);                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u7684 SELECT\uff0c\u5982\u4f55&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\/158784"}],"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=158784"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/158784\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158784"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}