{"id":2090,"date":"2012-01-09T23:38:10","date_gmt":"2012-01-09T15:38:10","guid":{"rendered":"http:\/\/jason695.why3s.tw\/wordpress\/?p=2090"},"modified":"2012-01-23T00:16:14","modified_gmt":"2012-01-22T16:16:14","slug":"%e5%bf%83%e8%8b%a5%e8%bb%9f%e8%82%9d%e5%b0%b1%e7%a1%ac","status":"publish","type":"post","link":"https:\/\/jason695.why3s.tw\/wordpress\/2012\/01\/09\/%e5%bf%83%e8%8b%a5%e8%bb%9f%e8%82%9d%e5%b0%b1%e7%a1%ac\/","title":{"rendered":"\u5fc3\u82e5\u8edf,\u809d\u5c31\u786c!!"},"content":{"rendered":"<p>\u9019\u662f\u4eca\u5929\u767c\u751f\u5728\u5de5\u4f5c\u4e0a\u7684\u4e8b&#8230;.<\/p>\n<p>\u7b49\u4e86\u597d\u4e45&#8230;\u7e3d\u7b97\u627e\u4f86\u5e6b\u6211\u89e3IR\u55ae\u7684\u4eba,<br \/>\n\u6211\u5fae\u5c0f\u7684\u8acb\u6c42\u7e3d\u7b97\u88ab\u807d\u898b\u4e86.<br \/>\n\u91dd\u5c0d\u9019\u4f4d\u4eba\u9078\u6211\u6709\u4e8c\u500b\u8981\u6c42,<br \/>\n\u4e00\u662f\u8981\u719fSQL,\u800c\u4e0d\u662f\u6703SQL\u800c\u5df2,<br \/>\n\u4e8c\u662f\u8981\u80fdUSER\u597d\u597d\u6e9d\u901a,\u4e0d\u6703\u8001\u55c6USER&#8230;.<br \/>\n(\u73fe\u5728\u60f3\u4f86\u6211\u958b\u7684\u9019\u5169\u500b\u689d\u4ef6\u597d\u50cf\u90fd\u662f\u91dd\u5c0d\u5c08\u6848\u7684\u67d0\u4eba&#8230;.\u54c8!!)<\/p>\n<p>\u4eca\u5929\u4eba\u529b\u516c\u53f8\u6703\u5148\u4f86\u4e00\u4f4d\u9762\u8a66,\u7531\u6211\u6e96\u5099\u8003\u984c\u6e2c\u9a57,<br \/>\n\u984c\u76ee\u4e0d\u96e3,\u6211\u76f8\u4fe1\u6709\u505a\u904eDW\u7684\u61c9\u8a72\u90fd\u6703,<br \/>\n\u4e0d\u6703\u5c31\u8981\u6253\u5c41\u80a1\u56c9!!<\/p>\n<p>\u984c\u76ee\u5927\u610f\u662f,<br \/>\n\u7b2c\u4e00\u984c\u8003\u7684\u662f\u5f9e\u4e00\u5806\u8cc7\u6599\u4e2d\u5206\u7fa4\u7d44\u5c0f\u8a08\u53ca\u8a08\u7b97\u5e73\u5747\u503c;<br \/>\n\u7b2c\u4e8c\u984c\u8003\u7684\u662fRANK\u7684\u8a9e\u6cd5.<\/p>\n<p>\u984c\u76ee\u4e0d\u96e3,\u4f46\u90a3\u4f4d\u4eba\u5144\u7684\u7b54\u6848\u4e0d\u80fd\u8aaa\u4e0d\u5c0d,\u53ea\u662f\u6548\u80fd\u5f88\u5dee,<br \/>\n\u7b2c\u4e00\u984c\u5148\u5728FROM\u7684\u90e8\u5206\u4e0b\u4e86\u5f88\u591aSELECT\u628a\u55ae\u4e00\u7fa4\u7d44\u7684COUNT\u3001SUM\u51fa\u4f86,<br \/>\n\u7136\u5f8c\u518dSELECT\u51fa\u4f86,\u8a9e\u610f\u5982\u4e0b:<\/p>\n<p>SELECT A1.\u67d0\u5c0f\u8a08, A2.\u67d0\u91d1\u984d, B1.\u67d0\u5c0f\u8a08, B2.\u67d0\u91d1\u984d<br \/>\nFROM<br \/>\n(SELECT COUNT(*) FROM X WHERE \u689d\u4ef6A) A1<br \/>\n(SELECT SUM(\u91d1\u984d) FROM X WHERE \u689d\u4ef6A) A2<br \/>\n(SELECT COUNT(*) FROM X WHERE \u689d\u4ef6B) B1<br \/>\n(SELECT SUM(\u91d1\u984d) FROM X WHERE \u689d\u4ef6B) B2<br \/>\n&#8230;&#8230;\u591a\u500b\u7fa4\u7d44<\/p>\n<p>\u591a\u6b21\u5c0d\u540c\u500bTABLE\u505aSELECT\u591a\u6b21&#8230;..<br \/>\n\u5927\u5bb6\u61c9\u8a72\u6703\u6709\u66f4\u597d\u7684\u505a\u6cd5,<br \/>\n\u8981\u662f\u6211\u6703\u7528\u4e00\u500bSELECT\u4ee5\u53caCASE WEHN\u4f86\u8a08\u7b97\u5404\u500b\u7fa4\u7d44.<\/p>\n<p>\u7b2c\u4e8c\u984c\u5462? \u4ed6\u597d\u50cf\u4e0d\u77e5\u6709RANK\u9019\u500b\u6307\u4ee4,<br \/>\n\u56e0\u6b64\u5beb\u4e86\u4e00\u9577\u4e32\u7684CURSOR\u91dd\u5c0d\u6bcf\u7b46\u8cc7\u6599\u4f5c\u6bd4\u5c0d,\u7136\u5f8cINERT\u5230TEMP TABLE.<\/p>\n<p>\u6211\u4e5f\u4e0d\u80fd\u8aaa\u4e0d\u5c0d&#8230;..\u53ea\u80fd\u8aaa\u9019\u500b\u4f5c\u6cd5&#8230;..<br \/>\n\u679c\u7136\u4e4b\u524d\u662f\u505aAP\u7684\u4f86\u8457.<\/p>\n<p>\u516c\u53f8PM\u554f\u6211\u9019\u500b\u4ebaOK\u55ce?<br \/>\n\u6211\u4e0d\u77e5\u54ea\u4f86\u7684\u5f35\u8001\u5e2b\u60b2\u5929\u61ab\u4eba\u6027\u683c\u767c\u4f5c&#8230;<br \/>\n\u300c\u5beb\u51fa\u4f86\u7684SQL\u6548\u80fd\u4e0d\u597d,\u61c9\u8a72\u4e4b\u524d\u6c92\u5b78\u904eTUNE\u6548\u80fd\u300d<br \/>\n\u300c\u5148\u5217\u5165\u89c0\u5bdf,\u770b\u4e4b\u5f8c\u9ede\u4e0d\u9ede\u7684\u901a\u5427!!\u300d<br \/>\n\u300c\u53ea\u662f,\u9084\u662f\u6703\u82b1\u5230\u6211\u7684\u6642\u9593\u300d<\/p>\n<p>\u516c\u53f8PM\u8aaa\u300c\u9019\u6a23\u600e\u9ebc\u53ef\u4ee5? \u4e0d\u662f\u8981\u627e\u4e00\u500b\u80fd\u99ac\u4e0a\u7528\u7684\u4eba\u55ce?\u300d<br \/>\n\u300c\u4e0d\u884c\u5c31\u8aaa,\u9000\u5c31\u597d\u300d<\/p>\n<p>\u5ba2\u6236\u90a3\u7684PM\u4e5f\u8aaa\u8a71\u4e86\u300c\u4f60\u78ba\u5b9a\u90a3\u500b\u4ebaOK? \u4e4b\u5f8c\u5982\u679c\u53c8\u8981\u589e\u52a0\u4f60\u5de5\u4f5c\u91cf\u7684\u8a71,<br \/>\n\u4e5f\u4e0d\u6703\u4ed8(MANDAY)\u7684\u9322\u5594!!\u300d<\/p>\n<p>\u4fd7\u8a71\u8aaa\u898b\u9762\u4e09\u5206\u60c5&#8230;.\u300c\u53eb\u4ed6\u8d70\u4eba\u300d\u9019\u53e5\u8a71\u6211\u8aaa\u4e0d\u51fa\u53e3\u5440!!<\/p>\n<p>\u300c\u8981\u4e0d\u7136\u5c31\u7531\u6211\u9019\u4f86\u505a\u9ed1\u81c9,\u8aaa\u9019\u4eba\u4e0dOK\u597d\u4e86,\u53eb\u4ed6\u4e0b\u5348\u5c31\u56de\u53bb\u300d<br \/>\n\u300c\u4e0d\u662f\u4eba\u529b\u516c\u53f8\u4f86\u5e7e\u500b\u6211\u5011\u90fd\u7167\u6536,\u8981\u7be9\u9078\u7684.\u300d<br \/>\n\u5ba2\u6236PM\u9019\u9ebc\u8aaa.<\/p>\n<p>\u4f46\u771f\u6b63\u8b93\u6211\u4e0b\u5b9a\u6c7a\u5fc3\u7684\u662f,\u5728\u6211\u8acb\u4ed6\u6539\u826f\u8003\u984cSQL\u6548\u80fd\u6642,<br \/>\n\u4ed6\u628aCOUNT(*)\u5beb\u5728CASE WHEN\u88e1\u9762\u4e86&#8230;&#8230;<\/p>\n<p>\u9019\u5df2\u7d93\u4e0d\u662f\u9ede\u4e0d\u9ede\u7684\u901a\u7684\u554f\u984c.<br \/>\n\u6700\u5f8c,\u6211\u628a\u9019\u96e3\u4e8b\u4ea4\u7d66\u4e3b\u7ba1\u5011\u53bb\u6e9d\u901a&#8230;.<\/p>\n<p>\u8981\u5bb3\u4ed6\u6c92\u5de5\u4f5c\u4e86&#8230;.\u90a3\u6642\u5fc3\u88e1\u53ea\u60f3\u8457\u9019\u500b&#8230;..<br \/>\n\u6211\u679c\u7136\u662f\u500b\u597d\u4eba(\u81ea\u5df1\u7d66\u81ea\u5df1\u767c\u5361,\u592a\u7d55\u4e86\u5427!!)<\/p>\n<p>\u73fe\u5728\u60f3\u4f86,\u53c8\u4e0d\u662f\u5973\u7684,\u6211\u5c0d\u4ed6\u90a3\u9ebc\u597d\u5e79\u561b!!<br \/>\n\u5982\u679c\u5230\u6642\u6211\u5de5\u4f5c\u91cf\u589e\u5927,\u624d\u771f\u5f97\u662f\u81ea\u505a\u81ea\u53d7.<\/p>\n<p>&#8220;\u5982\u679c\u4ee5\u5f8c\u627e\u4f86\u53c8\u8acb\u4e0d\u8d70\u600e\u9ebc\u8fa6?&#8221;<br \/>\n\u9019\u53c8\u6253\u5230\u6211\u4e00\u500b\u75db\u9ede&#8230;.<\/p>\n<p>\u6211\u7238\u807d\u5230\u6211\u6545\u4e8b\u5f8c\u8aaa\u7684\u6700\u4e2d\u80af,<br \/>\n&#8220;\u540c\u6a23\u90fd\u662f\u9818\u8001\u95c6\u7684\u9322,\u4f46\u4f60\u537b\u627e\u4e86\u500b\u4e0dOK\u7684\u4eba\u4f86,<br \/>\n\u5c31\u662f\u5c0d\u4e0d\u8d77\u81ea\u5df1\u7684\u8001\u95c6,\u9019\u6a23\u5c0d\u55ce?&#8221;<\/p>\n<p>\u6700\u5f8c\u9084\u662f\u8acb\u4ed6\u8d70\u4eba\u4e86\u5566!!<br \/>\n\u4e0b\u4e00\u4f4d\u8acb\u4e0a\u524d<\/p>\n<div id=\"-chrome-auto-translate-plugin-dialog\" style=\"display: none; opacity: 1 !important; border-color: none !important; background: transparent !important; padding: 0 !important; margin: 0 !important; position: absolute !important; top: 0; left: 0; overflow: visible !important; z-index: 999999 !important; text-align: left !important;\">\n<div style=\"max-width: 300px !important; color: #fafafa !important; opacity: 0.8 !important; border-color: #000000 !important; border-width: 0px !important; -webkit-border-radius: 10px !important; background-color: #363636 !important; font-size: 16px !important; padding: 8px !important; overflow: visible !important; background-image: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #000), color-stop(50%, #363636), color-stop(100%, #000)); z-index: 999999 !important; text-align: left  !important;\"><\/div>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" style=\"position: absolute !important; z-index: -1 !important; right: 1px !important; top: -20px !important; cursor: pointer !important; -webkit-border-radius: 20px; background-color: rgba(200, 200, 200, 0.3) !important; padding: 3px 5px 0 !important; margin: 0 !important;\" onclick=\"document.location.href='http:\/\/translate.google.com\/';\" src=\"https:\/\/i0.wp.com\/www.google.com\/uds\/css\/small-logo.png?w=712\" alt=\"\" \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u662f\u4eca\u5929\u767c\u751f\u5728\u5de5\u4f5c\u4e0a\u7684\u4e8b&#8230;. \u7b49\u4e86\u597d\u4e45&#8230;\u7e3d\u7b97\u627e\u4f86\u5e6b\u6211\u89e3IR\u55ae\u7684\u4eba, \u6211\u5fae\u5c0f\u7684\u8acb\u6c42\u7e3d\u7b97\u88ab &hellip; <a href=\"https:\/\/jason695.why3s.tw\/wordpress\/2012\/01\/09\/%e5%bf%83%e8%8b%a5%e8%bb%9f%e8%82%9d%e5%b0%b1%e7%a1%ac\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587 <span class=\"screen-reader-text\">\u5fc3\u82e5\u8edf,\u809d\u5c31\u786c!!<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[87],"tags":[],"class_list":["post-2090","post","type-post","status-publish","format-standard","hentry","category-ncb","no-featured-image"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts\/2090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/comments?post=2090"}],"version-history":[{"count":0,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts\/2090\/revisions"}],"wp:attachment":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/media?parent=2090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/categories?post=2090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/tags?post=2090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}