{"id":6844,"date":"2024-11-14T09:37:26","date_gmt":"2024-11-14T01:37:26","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6844\/"},"modified":"2024-11-14T09:37:26","modified_gmt":"2024-11-14T01:37:26","slug":"%e5%a6%82%e4%bd%95%e9%ab%98%e6%95%88%e6%9f%a5%e8%af%a2%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%ad%e6%89%80%e6%9c%89%e4%bb%bb%e5%8a%a1%e9%83%bd%e5%b7%b2%e5%ae%8c%e6%88%90%e7%9a%84%e7%94%a8%e6%88%b7%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6844\/","title":{"rendered":"\u5982\u4f55\u9ad8\u6548\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u4efb\u52a1\u90fd\u5df2\u5b8c\u6210\u7684\u7528\u6237\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/172999298594658.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u9ad8\u6548\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u4efb\u52a1\u90fd\u5df2\u5b8c\u6210\u7684\u7528\u6237\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u9ad8\u6548\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u4efb\u52a1\u90fd\u5df2\u5b8c\u6210\u7684\u7528\u6237\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u9ad8\u6548\u67e5\u8be2\u4efb\u52a1\u8fdb\u5ea6\u8868\u4e2d\u4efb\u52a1\u5168\u90e8\u5b8c\u6210\u7684\u7528\u6237\u4fe1\u606f<\/strong><\/p>\n<p>\u5728\u6570\u636e\u5e93\u4e2d\u7ef4\u62a4\u7740\u4efb\u52a1\u8fdb\u5ea6\u8868\uff0c\u5176\u4e2d\u8bb0\u5f55\u4e86\u6bcf\u4e2a\u7528\u6237\u7279\u5b9a\u4efb\u52a1\u7684\u5b8c\u6210\u72b6\u6001\u3002\u8868\u4e2d\u5305\u542b id\u3001user_id\u3001task \u548c status \u56db\u4e2a\u5b57\u6bb5\u3002\u7528\u6237\u53ea\u80fd\u62e5\u6709 123 \u4e09\u79cd\u4efb\u52a1\uff0c\u5e76\u4e14\u8868\u4e2d\u4f1a\u5305\u542b\u8be5\u7528\u6237\u7684\u6240\u6709\u4efb\u52a1\u8bb0\u5f55\u3002<\/p>\n<p>\u4efb\u52a1\u8fdb\u5ea6\u8868\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>id<\/th>\n<th>user_id<\/th>\n<th>task<\/th>\n<th>status<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>1<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>2<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>3<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u95ee\u9898\uff1a<\/strong>\u5982\u4f55\u9ad8\u6548\u67e5\u8be2\u4efb\u52a1\u8fdb\u5ea6\u8868\u4e2d\u4e09\u4e2a\u4efb\u52a1\u5168\u90e8\u5b8c\u6210\u7684\u7528\u6237\u4fe1\u606f\uff1f<\/p>\n<p><strong>\u7b54\u6848\uff1a<\/strong><\/p>\n<pre>select user_id from test where status=1 group by user_id having count(*)=3<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u89e3\u6790\uff1a<\/strong><\/p>\n<p>\u8be5\u67e5\u8be2\u9996\u5148\u7b5b\u9009\u51fa status \u4e3a 1\uff08\u8868\u793a\u5df2\u5b8c\u6210\uff09\u7684\u4efb\u52a1\u8bb0\u5f55\u3002\u7136\u540e\u6839\u636e user_id \u5bf9\u7ed3\u679c\u8fdb\u884c\u5206\u7ec4\uff0c\u8ba1\u7b97\u6bcf\u4e2a\u7528\u6237\u5b8c\u6210\u7684\u4efb\u52a1\u6570\u91cf\u3002\u6700\u540e\u901a\u8fc7 having count(*) = 3 \u8fc7\u6ee4\u51fa\u4efb\u52a1\u6570\u91cf\u4e3a 3 \u7684\u7528\u6237\uff0c\u5373\u4e09\u4e2a\u4efb\u52a1\u5747\u5df2\u5b8c\u6210\u7684\u7528\u6237\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u9ad8\u6548\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u4efb\u52a1\u90fd\u5df2\u5b8c\u6210\u7684\u7528\u6237\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\u9ad8\u6548\u67e5\u8be2\u4efb\u52a1\u8fdb\u5ea6\u8868\u4e2d\u4efb\u52a1\u5168\u90e8\u5b8c\u6210\u7684\u7528\u6237\u4fe1\u606f \u5728\u6570\u636e\u5e93\u4e2d\u7ef4\u62a4\u7740\u4efb\u52a1\u8fdb\u5ea6\u8868\uff0c\u5176\u4e2d\u8bb0\u5f55\u4e86\u6bcf\u4e2a\u7528\u6237\u7279\u5b9a\u4efb\u52a1\u7684\u5b8c\u6210\u72b6\u6001\u3002\u8868\u4e2d\u5305\u542b id\u3001user_id\u3001task \u548c status \u56db\u4e2a\u5b57\u6bb5\u3002\u7528\u6237\u53ea\u80fd\u62e5\u6709 123 \u4e09\u79cd\u4efb\u52a1\uff0c\u5e76\u4e14\u8868\u4e2d\u4f1a\u5305\u542b\u8be5\u7528\u6237\u7684\u6240\u6709\u4efb\u52a1\u8bb0\u5f55\u3002 \u4efb\u52a1\u8fdb\u5ea6\u8868\u793a\u4f8b\u5982\u4e0b\uff1a id user_id task status 1 1 1 0 2 1 2 1 3 1 3 0 4 2 1 1 5 2 2 1 6 2 3 1 7 3 1 0 8 3 2 1 9 3 3 1 \u95ee\u9898\uff1a\u5982\u4f55\u9ad8\u6548\u67e5\u8be2\u4efb\u52a1\u8fdb\u5ea6\u8868\u4e2d\u4e09\u4e2a\u4efb\u52a1\u5168\u90e8\u5b8c\u6210\u7684\u7528\u6237\u4fe1\u606f\uff1f \u7b54\u6848\uff1a select user_id from test [&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-6844","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6844","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=6844"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6844\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}