{"id":609,"date":"2012-07-12T13:23:59","date_gmt":"2012-07-12T13:23:59","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=59"},"modified":"2016-09-10T15:24:20","modified_gmt":"2016-09-10T15:24:20","slug":"group-by-status","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/group-by-status\/","title":{"rendered":"Group By Status"},"content":{"rendered":"<p>I have Table with Columns Name, EmailId, Process, Status Like Below. Now what i would like to have is the emailId and Status of people whoes Status are closed for all the Process &#8211; Process1, process2, process 3<\/p>\n<p><strong>Input<\/strong><br \/>\n&nbsp;<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codeatelier.files.wordpress.com\/2012\/07\/4.gif\" height=\"169\" width=\"265\" \/><\/p>\n<p><strong>Output<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codeatelier.files.wordpress.com\/2012\/07\/5.gif\" height=\"41\" width=\"112\" \/><\/p>\n<p><strong>Query1<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n  SELECT  fruit_email_id\r\n    FROM  Fruits AS t\r\n   GROUP BY fruit_email_id\r\n  HAVING COUNT( CASE WHEN Status  'Closed' \r\n                     THEN 1                       \r\n                      END) = 0;\r\n<\/pre>\n<p><strong>Query2<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n   SELECT  t.fruit_email_id\r\n     FROM  (SELECT DISTINCT fruit_email_id\r\n              FROM Fruits) AS t\r\n              LEFT JOIN Fruits AS tt ON  tt.fruit_email_id = t.fruit_email_id AND \r\n                   tt.Status  'Closed'\r\n    WHERE tt.fruit_email_id IS NULL;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have Table with Columns Name, EmailId, Process, Status Like Below. Now what i would like to have is the emailId and Status of people whoes Status are closed for all the Process &#8211; Process1, process2, process 3 Input &nbsp; Output Query1 SELECT fruit_email_id FROM Fruits AS t GROUP BY fruit_email_id HAVING COUNT( CASE WHEN&hellip; <a href=\"https:\/\/codethataint.com\/blog\/group-by-status\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-609","post","type-post","status-publish","format-standard","hentry","category-queries"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=609"}],"version-history":[{"count":2,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/609\/revisions"}],"predecessor-version":[{"id":1614,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/609\/revisions\/1614"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}