{"id":6137,"date":"2022-03-03T08:15:54","date_gmt":"2022-03-03T08:15:54","guid":{"rendered":"https:\/\/www.codebee.co.th\/labs\/?p=6137"},"modified":"2022-03-09T07:46:40","modified_gmt":"2022-03-09T07:46:40","slug":"query-%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b8%a1%e0%b8%b9%e0%b8%a5%e0%b8%8b%e0%b9%89%e0%b8%b3%e0%b8%81%e0%b8%b1%e0%b8%99","status":"publish","type":"post","link":"https:\/\/www.codebee.co.th\/labs\/query-%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b8%a1%e0%b8%b9%e0%b8%a5%e0%b8%8b%e0%b9%89%e0%b8%b3%e0%b8%81%e0%b8%b1%e0%b8%99\/","title":{"rendered":"MySQL \u0e27\u0e34\u0e18\u0e35 Query \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19"},"content":{"rendered":"\n<p>MySQL \u0e27\u0e34\u0e18\u0e35 Query \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19 \u0e43\u0e19\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17 SQL \u0e2d\u0e22\u0e48\u0e32\u0e07 MySQL \u0e21\u0e35\u0e27\u0e34\u0e18\u0e35\u0e43\u0e19\u0e01\u0e32\u0e23\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e41\u0e15\u0e48\u0e25\u0e30 Record \u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19 \u0e42\u0e14\u0e22\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e2d\u0e22\u0e48\u0e32\u0e07 GROUP BY, HAVING, COUNT \u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e19 \u0e0b\u0e36\u0e48\u0e07\u0e43\u0e19\u0e01\u0e32\u0e23\u0e40\u0e02\u0e35\u0e22\u0e19\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e2d\u0e32\u0e08\u0e08\u0e30\u0e21\u0e35\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48\u0e41\u0e15\u0e01\u0e15\u0e48\u0e32\u0e07\u0e01\u0e31\u0e19\u0e44\u0e1b\u0e15\u0e32\u0e21\u0e41\u0e19\u0e27\u0e17\u0e32\u0e07\u0e01\u0e32\u0e23\u0e40\u0e02\u0e35\u0e22\u0e19\u0e02\u0e2d\u0e07\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e40\u0e21\u0e2d\u0e23\u0e4c\u0e41\u0e15\u0e48\u0e25\u0e30\u0e17\u0e48\u0e32\u0e19 <\/p>\n\n\n\n<p>\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e23\u0e30\u0e17\u0e39\u0e49\u0e19\u0e35\u0e49\u0e08\u0e30\u0e21\u0e32\u0e41\u0e19\u0e30\u0e19\u0e33\u0e2d\u0e35\u0e01\u0e2b\u0e19\u0e36\u0e48\u0e07\u0e27\u0e34\u0e18\u0e35\u0e40\u0e02\u0e35\u0e22\u0e19 \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19\u0e43\u0e19 Column \u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e40\u0e0a\u0e48\u0e19\u0e43\u0e19\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19\u0e01\u0e32\u0e23\u0e1e\u0e31\u0e12\u0e19\u0e32\u0e40\u0e27\u0e47\u0e1a\u0e44\u0e0b\u0e15\u0e4c \u0e40\u0e23\u0e32\u0e2d\u0e32\u0e08\u0e08\u0e30\u0e21\u0e35\u0e1a\u0e32\u0e07\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19\u0e17\u0e35\u0e48\u0e40\u0e27\u0e47\u0e1a\u0e44\u0e0b\u0e15\u0e4c\u0e2b\u0e23\u0e37\u0e2d\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e02\u0e2d\u0e07\u0e40\u0e23\u0e32 \u0e08\u0e33\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e17\u0e23\u0e32\u0e1a\u0e01\u0e48\u0e2d\u0e19\u0e27\u0e48\u0e32\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19\u0e2d\u0e22\u0e39\u0e48\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48 \u0e16\u0e49\u0e32\u0e21\u0e35\u0e15\u0e49\u0e2d\u0e07\u0e17\u0e33\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e23 \u0e2d\u0e32\u0e08\u0e08\u0e30\u0e25\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e0b\u0e49\u0e33\u0e2d\u0e2d\u0e01\u0e44\u0e1b\u0e01\u0e48\u0e2d\u0e19 \u0e04\u0e48\u0e2d\u0e22\u0e17\u0e33\u0e07\u0e32\u0e19\u0e15\u0e48\u0e2d \u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e19<\/p>\n\n\n\n<p>\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e27\u0e34\u0e18\u0e35\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19\u0e43\u0e19\u0e15\u0e32\u0e23\u0e32\u0e07\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 \u0e41\u0e25\u0e30 Column \u0e44\u0e2b\u0e19 \u0e40\u0e23\u0e32\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e02\u0e35\u0e22\u0e19\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02\u0e44\u0e14\u0e49\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">SELECT col, COUNT(col) FROM table_name GROUP BY col HAVING COUNT(col) &gt; 1;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u0e17\u0e14\u0e2a\u0e2d\u0e1a\u0e01\u0e32\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19\u0e08\u0e32\u0e01\u0e15\u0e32\u0e23\u0e32\u0e07\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e08\u0e23\u0e34\u0e07 \u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e15\u0e32\u0e23\u0e32\u0e07\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e0a\u0e37\u0e48\u0e2d\u0e27\u0e48\u0e32 tb_name \u0e41\u0e25\u0e30 insert \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e25\u0e07\u0e44\u0e1b \u0e42\u0e14\u0e22\u0e43\u0e2b\u0e49\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e0b\u0e49\u0e33\u0e43\u0e19 Column \u0e0a\u0e37\u0e48\u0e2d\u0e27\u0e48\u0e32 name_th \u0e41\u0e25\u0e30 name_en \u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">CREATE TABLE `tb_name` (\n  `id` int(11) NOT NULL,\n  `name_th` varchar(200) COLLATE utf8_unicode_ci NOT NULL,\n  `name_en` varchar(200) COLLATE utf8_unicode_ci NOT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\n\nINSERT INTO `tb_name` (`id`, `name_th`, `name_en`) VALUES\n(1, '\u0e1b\u0e23\u0e32\u0e42\u0e21\u0e17\u0e22\u0e4c', 'PRAMOT'),\n(2, '\u0e18\u0e07\u0e0a\u0e31\u0e22', 'THONGCHAI'),\n(3, '\u0e01\u0e0a\u0e13\u0e34\u0e0a\u0e32', 'KOTNICHA'),\n(4, '\u0e18\u0e07\u0e0a\u0e31\u0e22', 'THONGCHAI');<\/code><\/pre>\n\n\n\n<p>\u0e08\u0e32\u0e01\u0e19\u0e31\u0e49\u0e19\u0e43\u0e0a\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e41\u0e2a\u0e14\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 name_th \u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19\u0e41\u0e25\u0e30\u0e08\u0e33\u0e19\u0e27\u0e19\u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19\u0e27\u0e48\u0e32\u0e21\u0e35\u0e01\u0e35\u0e48 column \u0e44\u0e14\u0e49\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">SELECT name_th, COUNT(name_th) FROM tb_name GROUP BY name_th HAVING COUNT(name_th) &gt; 1;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49\u0e08\u0e32\u0e01\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e14\u0e49\u0e32\u0e19\u0e1a\u0e19 \u0e01\u0e47\u0e08\u0e30\u0e41\u0e2a\u0e14\u0e07\u0e0a\u0e37\u0e48\u0e2d &#8220;\u0e18\u0e07\u0e0a\u0e31\u0e22&#8221; \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e0a\u0e37\u0e48\u0e2d\u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19 \u0e41\u0e25\u0e30 \u0e08\u0e33\u0e19\u0e27\u0e19\u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19\u0e04\u0e37\u0e2d 2<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u0e27\u0e34\u0e18\u0e35 Query \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19 \u0e43\u0e19\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17 SQL \u0e2d\u0e22\u0e48\u0e32\u0e07 MySQL \u0e21\u0e35\u0e27\u0e34\u0e18\u0e35\u0e43\u0e19\u0e01\u0e32\u0e23\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e41\u0e15\u0e48\u0e25\u0e30 Record \u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19 \u0e42\u0e14\u0e22\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e2d\u0e22\u0e48\u0e32\u0e07 GROUP BY, HAVING, COUNT \u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e19 \u0e0b\u0e36\u0e48\u0e07\u0e43\u0e19\u0e01\u0e32\u0e23\u0e40\u0e02\u0e35\u0e22\u0e19\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e2d\u0e32\u0e08\u0e08\u0e30\u0e21\u0e35\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48\u0e41\u0e15\u0e01\u0e15\u0e48\u0e32\u0e07\u0e01\u0e31\u0e19\u0e44\u0e1b\u0e15\u0e32\u0e21\u0e41\u0e19\u0e27\u0e17\u0e32\u0e07\u0e01\u0e32\u0e23\u0e40\u0e02\u0e35\u0e22\u0e19\u0e02\u0e2d\u0e07\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e40\u0e21\u0e2d\u0e23\u0e4c\u0e41\u0e15\u0e48\u0e25\u0e30\u0e17\u0e48\u0e32\u0e19 \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e23\u0e30\u0e17\u0e39\u0e49\u0e19\u0e35\u0e49\u0e08\u0e30\u0e21\u0e32\u0e41\u0e19\u0e30\u0e19\u0e33\u0e2d\u0e35\u0e01\u0e2b\u0e19\u0e36\u0e48\u0e07\u0e27\u0e34\u0e18\u0e35\u0e40\u0e02\u0e35\u0e22\u0e19 \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e17\u0e35\u0e48\u0e0b\u0e49\u0e33\u0e01\u0e31\u0e19\u0e43\u0e19&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6143,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"video","meta":{"footnotes":""},"categories":[46],"tags":[1897,2563,1677,2562,501],"class_list":["post-6137","post","type-post","status-publish","format-video","has-post-thumbnail","hentry","category-website-development-","tag-database-query","tag-group-by","tag-mysql","tag-query-","tag-501","post_format-post-format-video"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/posts\/6137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/comments?post=6137"}],"version-history":[{"count":5,"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/posts\/6137\/revisions"}],"predecessor-version":[{"id":6160,"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/posts\/6137\/revisions\/6160"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/media\/6143"}],"wp:attachment":[{"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/media?parent=6137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/categories?post=6137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codebee.co.th\/labs\/wp-json\/wp\/v2\/tags?post=6137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}