{"id":656,"date":"2011-10-20T16:52:02","date_gmt":"2011-10-20T07:52:02","guid":{"rendered":"https:\/\/www.jaswill.co.jp\/blog\/2011\/10\/20\/postgresql_1\/"},"modified":"2011-10-20T16:52:02","modified_gmt":"2011-10-20T07:52:02","slug":"postgresql_1","status":"publish","type":"post","link":"https:\/\/www.jaswill.co.jp\/blog\/2011\/10\/20\/postgresql_1\/","title":{"rendered":"PostgreSQL\u3000\u6587\u5b57\u5217\u3092\u9806\u756a\u306b\u30bd\u30fc\u30c8"},"content":{"rendered":"<p>PostgreSQL ver 8.4 \u3067\u52d5\u4f5c\u6e08\u307f<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6570\u5b57\u304c\u5165\u3063\u3066\u3044\u308b\u6587\u5b57\u5217\u3092\u6607\u9806\u30fb\u964d\u9806\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3000\u4f8b\u3000\uff09<br \/>\n\u3000\u3000jaswill1<br \/>\n\u3000\u3000jaswill2<br \/>\n\u3000\u3000jaswill3<\/p>\n<p>\u3010\u6587\u5b57\u5217\u30bd\u30fc\u30c8\u3011<\/p>\n<p><b><font style=\"color:#990000\">\u3000ORDER BY<\/font><\/b> <br \/>\n\u3000\u3000\u3000\u3000<b><font style=\"color:#DD0000\">TO_NUMBER<\/font><\/b> ( SUBSTRING ( USR_ID <b><font style=\"color:#990000\">FROM<\/font><\/b> <font style=\"color:#0000CC\">&#8216;[0-9].*$&#8217;<\/font> ) , <font style=\"color:#0000CC\">&#8216;[9]&#8217;<\/font> ) , USR_ID<\/p>\n<fieldset style=\"border:1px solid #0000CD;padding:5px\">\n<br \/>ORDER NY\u53e5\u306b\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u300cSUBSTRING\u300d\u3067\u90e8\u5206\u6587\u5b57\u5217\uff08\u5f8c\u308d\u306e<font style=\"color:#0000CC\">&#8216;[9]&#8217;<\/font>\uff09\u3092\u53d6\u5f97\u3057\u3001<\/p>\n<p>\u300cTO_NUMBER\u300d\u3067\u6570\u5024\u306b\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002FORM\u53e5\u3067\u306f\u6761\u4ef6\u306b\u8a72\u5f53\u3059\u308b\u3082\u306e\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u306f\u6607\u9806\u304b\u964d\u9806\u304b\u3092ORDER BY\u53e5\u306b\u8ffd\u8a18\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<\/fieldset>\n<p>\n\u3042\u3068\u3001\u3088\u304f\u3042\u308b\u306e\u304c\u91cd\u8907\u30c1\u30a7\u30c3\u30af\u3067\u3059\u306d\u3002<\/p>\n<p>\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001\u30e1\u30e2\u30e1\u30e2 \u03c6(\u3002\u3002)<\/p>\n<p>\u3010\u91cd\u8907\u30c7\u30fc\u30bf\u53d6\u5f97\u3011&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><b><font style=\"color:#990000\">\u3000SELECT <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000A.USR_ID AS USR_ID <br \/>\n<b><font style=\"color:#990000\">\u3000FROM <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000TABLE_A A <br \/>\n<b><font style=\"color:#990000\">\u3000WHERE <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000A.DELETE_FLG = 0 <br \/>\n<b><font style=\"color:#990000\">\u3000GROUP BY <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000A.USR_ID <br \/>\n<b><font style=\"color:#990000\">\u3000HAVING <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000<b><font style=\"color:#DD0000\">COUNT<\/font> <\/b>( A.USR_ID )&nbsp; &gt;&nbsp; 1\u3000<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>\u3000\u3063\u3067\u3001\u2191\u30b3\u30ec\u3092\u3010\u6587\u5b57\u5217\u30bd\u30fc\u30c8\u3011\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u30fb\u30fb\u30fb<\/p>\n<p>\u3010\u91cd\u8907\u30c7\u30fc\u30bf\u306e\u6587\u5b57\u5217\u30bd\u30fc\u30c8\u3011&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><b><font style=\"color:#990000\">\u3000SELECT <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000A.USR_ID AS USR_ID<b><br \/>\u3000<font style=\"color:#990000\">FROM <\/font><\/b><br \/>\u3000\u3000\u3000\u3000TABLE_A A <b><br \/>\u3000<font style=\"color:#990000\">WHERE <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000A.DELETE_FLG = 0<b><br \/>\u3000\u3000\u3000 <font style=\"color:#990000\">AND<\/font><\/b><br \/>\n<b><font style=\"color:#990000\">\u3000\u3000\u3000 EXISTS<\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000(&nbsp; <b><font style=\"color:#990000\">SELECT <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000AA.USR_ID AS USR_ID<b><br \/>\u3000\u3000\u3000\u3000\u3000<font style=\"color:#990000\">FROM <\/font><\/b><br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000TABLE_A AA<b><br \/>\u3000\u3000\u3000\u3000\u3000<font style=\"color:#990000\">WHERE <\/font><\/b><br \/>&nbsp;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 AA.USR_ID = A.USR_ID<b><font style=\"color:#990000\"><br \/>\u3000\u3000\u3000\u3000\u3000GROUP BY <\/font><\/b><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AA.USR_ID<br \/>\n<b><font style=\"color:#990000\"><br \/>\u3000\u3000\u3000\u3000\u3000HAVING <\/font><\/b><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n<b><font style=\"color:#DD0000\">COUNT<\/font> <\/b>( AA.USR_ID )&nbsp; &gt;&nbsp; 1 <br \/>\u3000\u3000\u3000\u3000)<br \/><b>\u3000<font style=\"color:#990000\">ORDER BY<\/font><\/b> <br \/>\u3000\u3000\u3000\u3000<b><font style=\"color:#DD0000\"> TO_NUMBER<\/font><\/b> ( SUBSTRING ( A.USR_ID <b><font style=\"color:#990000\">FROM<\/font><\/b> <font style=\"color:#0000CC\">&#8216;[0-9].*$&#8217;<\/font> ) , <font style=\"color:#0000CC\">&#8216;[9]&#8217;<\/font> ) , A.USR_ID <br \/>\u3000\u3000\u3000\u3000,A.USR_ID DESC\uff08ASC\uff09<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>\u30fb\u30fb\u30fb\u96d1\u3060\u3051\u3069\u6c17\u306b\u3057\u306a\u3044\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u91cd\u8907\u3057\u305f\u6587\u5b57\u5217\u3092\u30bd\u30fc\u30c8\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5206\u304b\u308a\u3084\u3059\u3044\u3088\u3046\u306b\u3001\u30ca\u30f3\u30d0\u30fc\uff08No\uff09\u3068\u304b\u3064\u3051\u308b\u3068\u3001\u9806\u756a\u306b\u306a\u3063\u3066\u3044\u308b\u4e8b\u304c\u5206\u304b\u308a\u3084\u3059\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3061\u3087\u3063\u3068\u3057\u305f\u5099\u5fd8\u9332\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL ver 8.4 \u3067\u52d5\u4f5c\u6e08\u307f \u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6570\u5b57\u304c\u5165\u3063\u3066\u3044\u308b\u6587\u5b57\u5217\u3092\u6607\u9806\u30fb\u964d\u9806\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u3000\u4f8b\u3000\uff09 \u3000\u3000jaswill1 \u3000\u3000jaswill2 \u3000\u3000jaswill3 \u3010\u6587\u5b57\u5217\u30bd\u30fc\u30c8\u3011 \u3000ORDER BY \u3000\u3000\u3000\u3000TO_NUMBER ( SUBSTRING ( USR_ID  [&hellip;]<\/p>\n","protected":false},"author":36,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[488],"tags":[271,272,273,257,269,270],"class_list":["post-656","post","type-post","status-publish","format-standard","hentry","category-it","tag-271","tag-272","tag-273","tag-postgresql","tag-269","tag-270"],"views":20,"_links":{"self":[{"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/posts\/656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=656"}],"version-history":[{"count":0,"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/posts\/656\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaswill.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}