{"id":784,"date":"2015-03-25T14:59:01","date_gmt":"2015-03-25T14:59:01","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=784"},"modified":"2015-03-26T13:13:23","modified_gmt":"2015-03-26T13:13:23","slug":"query-for-overlapping-event-and-subevents","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/query-for-overlapping-event-and-subevents\/","title":{"rendered":"Query for Overlapping Event and SubEvents"},"content":{"rendered":"<p><strong>Scenario<\/strong><\/p>\n<p><em>Event &#8211; Parent Event<br \/>\nSub-Event &#8211; Child Event<br \/>\n<\/em><\/p>\n<p>1.The Events contains multiple sub events.<br \/>\n2.When there is Parent event,  there should be No sub event of that Parent event in that same period<br \/>\n3.There can me more than one sub event of the same Parent event in the same period.There can be overlapping sub event. <\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n SELECT COUNT(ParentEventId)    \r\n    FROM Events\r\n   WHERE lower(status) = 'open'\r\n     AND ParentEventId = p_parent_id\r\n      AND (ChildEvent is null or p_child_event IS NULL OR\r\n          ChildEvent = NVL(p_child_event, child_event))\r\n     AND (p_startdate BETWEEN StartDate AND\r\n          EndDate OR\r\n          p_admin_enddate BETWEEN StartDate AND\r\n          EndDate OR\r\n          (p_startdate &lt;= StartDate AND\r\n          p_enddate &gt;= EndDate));\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Scenario Event &#8211; Parent Event Sub-Event &#8211; Child Event 1.The Events contains multiple sub events. 2.When there is Parent event, there should be No sub event of that Parent event in that same period 3.There can me more than one sub event of the same Parent event in the same period.There can be overlapping sub&hellip; <a href=\"https:\/\/codethataint.com\/blog\/query-for-overlapping-event-and-subevents\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[84],"tags":[],"class_list":["post-784","post","type-post","status-publish","format-standard","hentry","category-software-design"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/784","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=784"}],"version-history":[{"count":3,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/784\/revisions"}],"predecessor-version":[{"id":789,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/784\/revisions\/789"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}