{"id":193287,"date":"2020-11-14T16:19:06","date_gmt":"2020-11-14T08:19:06","guid":{"rendered":"http:\/\/4563.org\/?p=193287"},"modified":"2020-11-14T16:19:06","modified_gmt":"2020-11-14T08:19:06","slug":"%e5%8f%91%e7%8e%b0%e5%a4%9a%e7%a7%8d%e6%95%b0%e6%8d%ae%e5%ba%93-group-by-%e5%af%b9%e5%ad%97%e7%ac%a6%e4%b8%b2%e9%a6%96%e5%b0%be%e7%a9%ba%e6%a0%bc%e7%9a%84%e5%9d%91%e6%ad%bb%e4%ba%ba%e4%b8%8d%e5%81%bf","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=193287","title":{"rendered":"\u53d1\u73b0\u591a\u79cd\u6570\u636e\u5e93 group by \u5bf9\u5b57\u7b26\u4e32\u9996\u5c3e\u7a7a\u683c\u7684\u5751\u6b7b\u4eba\u4e0d\u507f\u547d\u89c4\u8303"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u53d1\u73b0\u591a\u79cd\u6570\u636e\u5e93 group by \u5bf9\u5b57\u7b26\u4e32\u9996\u5c3e\u7a7a\u683c\u7684\u5751\u6b7b\u4eba\u4e0d\u507f\u547d\u89c4\u8303               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiangyuecn <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>rt \u5df2\u6d4b\u8bd5 mysql sqlserver<\/p>\n<p>&#8220;\u5b57\u7b26\u4e32&#8221; &#8220;\u5b57\u7b26\u4e32 &#8221; \u4f1a\u5206\u5230\u540c\u4e00\u7ec4<\/p>\n<p>&#8220;\u5b57\u7b26\u4e32&#8221; &#8221; \u5b57\u7b26\u4e32&#8221; \u53c8\u4e0d\u4f1a\u5206\u5230\u540c\u4e00\u7ec4<\/p>\n<p>\u8fd9\u79cd\u9ed8\u8ba4\u64cd\u4f5c\u7ad9\u5728\u5b57\u7b26\u6570\u636e\u5b58\u50a8\u7684\u89d2\u5ea6\uff0c\u548c\u9ed8\u8ba4\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u4e00\u6837\u611a\u8822\u81f3\u6781\uff0c\u672c\u4eba\u89c2\u70b9\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>19<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4179231\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lxk11153 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u6709\u8fd9\u4e2a feature [doge]                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179232\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiangyuecn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u90fd\u662f\u7a7a\uff0c\u8868\u73b0\u8fd8\u4e0d\u4e00\u6837\uff1a<\/p>\n<p>u00a0==&#8217; &#8216; mysql\u2705\uff0csqlserver\u274c<br \/>u2000==&#8217; &#8216; mysql\u2705\uff0csqlserver\u274c<br \/>u3000==&#8217; &#8216; mysql\u2705\uff0csqlserver\u2705<\/p>\n<p>\u5b57\u7b26\u4e32\u9996\u5c3e\u7a7a\u683c\uff0c\u4f3c\u4e4e\u8fd8\u5f71\u54cd\u5230\u4e86 len \u3001length \u3001=\u3001!= \u3001in\uff0c\u592a\u53ef\u6015\uff0c\u8fd9\u79cd\u529f\u80fd\u5374\u4e0d\u662f\u53e6\u5916\u5f00\u4e00\u4e2a\u660e\u786e\u8868\u610f\u7684\u51fd\u6570\u6765\u505a\uff0c\u9ed1\u6697\u3001\u53ef\u6015                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179233\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : DonaldY <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6240\u4ee5\uff0c\u8fd9\u79cd\u9700\u8981 group by \u7684\u5b57\u6bb5\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0 \u7a7a\u683c\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179234\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : philchang1995 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @DonaldY \u8868\u8bbe\u8ba1\u7684\u65f6\u5019\u80fd\u628a\u540e\u7eed\u6240\u6709\u9700\u6c42\u90fd\u8003\u8651\u5230\u4e48\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179235\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : telung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53d1\u73b0\u4e86\u8fd9\u4e48\u5927\u7684 BUG, \u5feb\u63d0\u7ed9 MYSQL \u56e2\u961f\uff0c\u5fae\u8f6f\u516c\u53f8\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179236\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liprais <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u7528\u7684\u662f varchar \u8fd8\u662f char?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179237\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nikan999 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u60c5\u51b5 \u662f\u4e0d\u662f\u8003\u8651\u6570\u636e\u4e25\u683c\u76f8\u7b49\u6bd4\u8f83\u597d\uff0c\u4e0d\u8981\u53bb\u4f9d\u8d56\u6570\u636e\u5e93\u7684\u5177\u4f53\u5b9e\u73b0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179238\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiangyuecn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @DonaldY #3 \u6211\u4e5f\u4ee5\u4e3a\u662f group by \u6709\u5f71\u54cd\uff0c\u4f46 len \u3001length \u3001=\u3001!= \u90fd\u6709\u5f71\u54cd\u3002\u5e76\u4e14\u7a7a\u683c\u8fd9\u4e2a\u5b9a\u4e49\u592a\u5bbd\u6cdb\uff0c\u4e0d\u540c\u8bed\u8a00\u5b9e\u73b0\u5b8c\u5168\u4e0d\u4e00\u81f4\uff0c\u6570\u636e\u5e93\u89c4\u8303\u5b8c\u5168\u662f\u5728\u6316\u5751\u3002<\/p>\n<p>js \u53ef\u4ee5 trim \u6389\u5e38\u89c1\u4f46\u53c8\u6572\u4e0d\u51fa\u7684\u7a7a\u683c\uff0c\u5982\u6211 2 \u8fd9 3 \u4e2a<\/p>\n<p>java \u53ea\u80fd trim \u6389 u0020 \u952e\u76d8\u6572\u51fa\u6765\u7684\u8fd9\u4e2a\u7a7a\u683c\uff0c\u5176\u4ed6\u7a7a\u683c trim \u4e0d\u6389<\/p>\n<p>\u5176\u4ed6\u8bed\u8a00\u6ca1\u6d4b\u8bd5 trim\uff0c\u53cd\u6b63\u603b\u6709\u4e2a\u5730\u65b9\u4f1a\u8ba9\u4f60\u8df3\u8fdb\u53bb                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179239\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiangyuecn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @telung #5 \u522b\u95f9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179240\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiangyuecn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @nikan999 #7 \u55ef\uff0c\u8fd9\u662f\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u624d\u4f1a\u51fa\u73b0\u7684\u5751\uff0c\u5982\u679c\u6211\u8981\u7279\u610f\u53bb\u89c4\u907f\uff0c\u81ea\u7136\u6709\u5f88\u591a\u529e\u6cd5\u3002\u4f46\u8fd9\u79cd\u9ed8\u8ba4\u8ba9\u666e\u901a\u7684\u5efa\u8868\u3001\u67e5\u8be2\u5f88\u53d7\u4f24                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179241\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : syozzz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ece\u6765\u8fd8\u6ca1\u6ce8\u610f\u8fc7\u8fd9\u4e2a\u95ee\u9898==                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179242\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : CRVV <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/www.postgresql.org\/docs\/current\/datatype-character.html<\/p>\n<p>\u7f51\u9875\u5185\u641c\u7d22 SQL standard<br \/>This somewhat bizarre exception is required by the SQL standard<\/p>\n<p>\u901a\u5e38\u90fd\u7528 VARCHAR \u7684\uff0c\u6ca1\u8fd9\u4e2a\u95ee\u9898<\/p>\n<p>\u6216\u8005\u4e0a PostgreSQL \u5168\u7528 TEXT \u5b8c\u4e8b\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179243\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f80\u540e\u7aef\u4f20\u7684\u65f6\u5019\u90fd\u4e0d trim \u6389\u9996\u5c3e\u7a7a\u683c\u7684\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179244\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : PopRain <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4fdd\u5b58\u6570\u636e\u65f6\u968f\u4fbf\u4fdd\u5b58\uff0c\u4e0d\u6ce8\u610f\u89c4\u8303\u6570\u636e\uff0c\u56de\u5934\u53cd\u8fc7\u6765\u8d56\u6570\u636e\u5e93\u2026\u2026\u2026\u5c3e\u90e8\u7a7a\u683c\u5ffd\u7565\u6389\u7684\u4e3b\u8981\u539f\u56e0\u662f\u6700\u65e9\u6570\u636e\u5e93\u5927\u90e8\u5206\u7528\u56fa\u5b9a\u957f\u5ea6\u7684 Char \u7c7b\u578b\uff0c\u5ffd\u7565\u5c3e\u90e8\u7a7a\u683c\u65b9\u4fbf\u6bd4\u8f83\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179245\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiangyuecn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @PopRain \u5178\u578b\u7684\u4ee5\u504f\u6982\u5168                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179246\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiangyuecn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @PopRain \u53cd\u5012\u662f\u65e9\u671f char \u7c7b\u578b\uff0c\u5982\u679c\u7a0b\u5e8f\u5b58\u5165\u7684\u4e0d\u662f\u56fa\u5b9a\u957f\u5ea6\uff0c\u4f9d\u8d56\u6570\u636e\u5e93\u6765\u4fdd\u8bc1\u957f\u5ea6\u4e00\u81f4\u6027\uff0c\u90a3\u624d\u662f\u771f\u6b63\u7684\u4e71\u5b58\u6570\u636e\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179247\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : PopRain <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             SQL Server follows the ANSI\/ISO SQL-92 specification (Section 8.2, &lt;Comparison Predicate&gt;, General rules #3) on how to compare strings with spaces. The ANSI standard requires padding for the character strings used in comparisons so that their lengths match before comparing them. The padding directly affects the semantics of WHERE and HAVING clause predicates and other Transact-SQL string comparisons. For example, Transact-SQL considers the strings &#8216;abc&#8217; and &#8216;abc &#8216; to be equivalent for most comparison operations.<\/p>\n<p>The only exception to this rule is the LIKE predicate. When the right side of a LIKE predicate expression features a value with a trailing space, SQL Server does not pad the two values to the same length before the comparison occurs. Because the purpose of the LIKE predicate, by definition, is to facilitate pattern searches rather than simple string equality tests, this does not violate the section of the ANSI SQL-92 specification mentioned earlier.                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179248\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : EminemW <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u5565\u6570\u636e\u5e93\u4f1a\u5b58\u9996\u5c3e\u6709\u7a7a\u683c\u7684\u5b57\u7b26\u4e32\uff0c\u662f\u6709\u4ec0\u4e48\u7279\u6b8a\u4f5c\u7528\u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4179249\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gulu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u660e\u660e\u5c31\u662f\u6570\u636e\u5e93\u884c\u4e3a\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u5404\u79cd\u602a\u6570\u636e\u81ea\u8eab\u4e0d\u89c4\u8303\u7684\u3002<br \/>\u5c31 &#8220;ABC&#8221; \u80fd\u505a\u5b57\u7b26\u4e32\uff0c&#8221; ABC&#8221; \u5c31\u4e0d\u914d\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u53d1\u73b0\u591a\u79cd\u6570\u636e\u5e93 group by &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\/193287"}],"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=193287"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/193287\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193287"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}