{"id":4,"date":"2010-07-05T18:18:10","date_gmt":"2010-07-05T16:18:10","guid":{"rendered":"http:\/\/www.hurmuzov.com\/?p=4"},"modified":"2010-07-05T18:29:19","modified_gmt":"2010-07-05T16:29:19","slug":"sql-countdistinct-on-multiple-columns-syntax","status":"publish","type":"post","link":"https:\/\/www.hurmuzov.com\/?p=4","title":{"rendered":"SQL COUNT(DISTINCT&#8230;) on multiple columns &#8211; syntax"},"content":{"rendered":"<p><strong>MySQL<\/strong><\/p>\n<p>SELECT COUNT(DISTINCT column1, column2) FROM mytable;<\/p>\n<p><strong>ORACLE<\/strong><\/p>\n<p>SELECT COUNT(DISTINCT column1 || column2) FROM mytable;<\/p>\n<p>I&#8217;ll check what is the syntax for Informix server.<\/p>\n<p>JPA (Java Persistence API) do not support multiple columns in statements like these, so you should use createNativeQuery();<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL SELECT COUNT(DISTINCT column1, column2) FROM mytable; ORACLE SELECT COUNT(DISTINCT column1 || column2) FROM mytable; I&#8217;ll check what is the syntax for Informix server. JPA (Java Persistence API) do not support multiple columns in statements like these, so you should use createNativeQuery();<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=\/wp\/v2\/posts\/4"}],"collection":[{"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4"}],"version-history":[{"count":4,"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions"}],"predecessor-version":[{"id":7,"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions\/7"}],"wp:attachment":[{"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hurmuzov.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}