<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Juju: Find Intersection of Two Date Ranges</title>
    <link>http://www.juju.org/articles/2008/07/29/find-intersection-of-two-date-ranges</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Sufficiently Advanced Technology</description>
    <item>
      <title>Find Intersection of Two Date Ranges</title>
      <description>&lt;p&gt;Say you have a database of events that span multiple days and you want to filter all events between a certain date range.  At first I had this giant mess of this AND that OR this AND that... until I found &lt;a href="http://bloggingabout.net/blogs/egiardina/archive/2008/01/30/check-intersection-of-two-date-ranges-in-sql.aspx"&gt;this&lt;/a&gt;:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;NOT (range1_start &amp;gt; range2_end OR range1_end &amp;lt; range2_start)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That freakin' rules.&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jul 2008 12:23:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:cc58cba8-8ab8-4a00-aa48-2889dff37002</guid>
      <author>Tony Buser</author>
      <link>http://www.juju.org/articles/2008/07/29/find-intersection-of-two-date-ranges</link>
      <category>Code</category>
      <category>sql</category>
      <category>programming</category>
      <trackback:ping>http://www.juju.org/articles/trackback/917</trackback:ping>
    </item>
  </channel>
</rss>
