title: Filter a spark dataframe with a greater than and a less than of list of dates
body: <p>I have a <code>dataframe</code> with the fields <code>from_date</code> and <code>to_date</code>:</p>
  
  <pre><code>(2017-01-10     2017-01-14)
  (2017-01-03     2017-01-13)
  </code></pre>
  
  <p>and a List of dates</p>
  
  <pre><code>2017-01-05,
  2017-01-12,
  2017-01-13,
  2017-01-15
  </code></pre>
  
  <p>The idea is to retrieve from the table all the rows in which that date list is between from_date and to_date. </p>
  
  <p>Expected output : </p>
  
  <p>the same dataframe but only the rows in whose (from_date and to_date) are in the range (&lt;= or >=) of the values of the date list .
  I tried so far the Nikk recommendation : </p>
  
  <p><a href="https://stackoverflow.com/questions/56460631/filter-a-spark-dataframe-with-a-greater-than-and-a-less-than-of-list-of-dates/56471919#56471919">Filter a spark dataframe with a greater than and a less than of list of dates</a></p>
  
  <p>but Im need to compare with the whole list of dates , something like that :</p>
  
  <pre><code>
  spark.sql("select * from dataframe_table where from_date  &gt;= (select  date from date_list) AND  to_date  &lt;= (select date from date_list)")
  
  </code></pre>