{"id":3187,"date":"2023-10-21T22:22:51","date_gmt":"2023-10-21T14:22:51","guid":{"rendered":"https:\/\/white-night.club\/?p=3187"},"modified":"2023-11-09T11:07:47","modified_gmt":"2023-11-09T03:07:47","slug":"ad80","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/21\/ad80\/","title":{"rendered":"586.\u00a0\u8ba2\u5355\u6700\u591a\u7684\u5ba2\u6237"},"content":{"rendered":"\n<p>\u8868:&nbsp;<code>Orders<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-----------------+----------+\n| Column Name     | Type     |\n+-----------------+----------+\n| order_number    | int      |\n| customer_number | int      |\n+-----------------+----------+\n\u5728 SQL \u4e2d\uff0cOrder_number\u662f\u8be5\u8868\u7684\u4e3b\u952e\u3002\n\u6b64\u8868\u5305\u542b\u5173\u4e8e\u8ba2\u5355ID\u548c\u5ba2\u6237ID\u7684\u4fe1\u606f\u3002\n<\/pre>\n\n\n\n<p>\u67e5\u627e\u4e0b\u4e86&nbsp;<strong>\u6700\u591a\u8ba2\u5355<\/strong>&nbsp;\u7684\u5ba2\u6237\u7684&nbsp;<code>customer_number<\/code>&nbsp;\u3002<\/p>\n\n\n\n<p>\u6d4b\u8bd5\u7528\u4f8b\u751f\u6210\u540e\uff0c&nbsp;<strong>\u6070\u597d\u6709\u4e00\u4e2a\u5ba2\u6237<\/strong>&nbsp;\u6bd4\u4efb\u4f55\u5176\u4ed6\u5ba2\u6237\u4e0b\u4e86\u66f4\u591a\u7684\u8ba2\u5355\u3002<\/p>\n\n\n\n<p>\u67e5\u8be2\u7ed3\u679c\u683c\u5f0f\u5982\u4e0b\u6240\u793a\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> \nOrders \u8868:\n+--------------+-----------------+\n| order_number | customer_number |\n+--------------+-----------------+\n| 1            | 1               |\n| 2            | 2               |\n| 3            | 3               |\n| 4            | 3               |\n+--------------+-----------------+\n<strong>\u8f93\u51fa:<\/strong> \n+-----------------+\n| customer_number |\n+-----------------+\n| 3               |\n+-----------------+\n<strong>\u89e3\u91ca:<\/strong> \ncustomer_number \u4e3a '3' \u7684\u987e\u5ba2\u6709\u4e24\u4e2a\u8ba2\u5355\uff0c\u6bd4\u987e\u5ba2 '1' \u6216\u8005 '2' \u90fd\u8981\u591a\uff0c\u56e0\u4e3a\u4ed6\u4eec\u53ea\u6709\u4e00\u4e2a\u8ba2\u5355\u3002\n\u6240\u4ee5\u7ed3\u679c\u662f\u8be5\u987e\u5ba2\u7684 customer_number \uff0c\u4e5f\u5c31\u662f 3 \u3002\n<\/pre>\n\n\n\n<p><strong>\u8fdb\u9636\uff1a<\/strong>&nbsp;\u5982\u679c\u6709\u591a\u4f4d\u987e\u5ba2\u8ba2\u5355\u6570\u5e76\u5217\u6700\u591a\uff0c\u4f60\u80fd\u627e\u5230\u4ed6\u4eec\u6240\u6709\u7684&nbsp;<code>customer_number<\/code>&nbsp;\u5417\uff1f<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>GROUP BY<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u76f4\u63a5GROUP BY\uff0c\u5b8c\u4e8b\u3002\u81f3\u4e8e\u8fdb\u9636\uff0c\u7528\u7a97\u53e3\u51fd\u6570\u5e94\u8be5\u80fd\u89e3\u51b3\uff0c\u4e0b\u6b21\u78b0\u5230\u518d\u8bd5\u8bd5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT customer_number\r\nFROM Orders\r\nGROUP BY customer_number\r\nHAVING COUNT(order_number)\r\nORDER BY COUNT(order_number) DESC\r\nLIMIT 1<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1aGROUP BY<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3187"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=3187"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3187\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=3187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}