title: Pull Data between dynamic date range
body: <p>Below is the query, where <code>sf.flex_start_date</code> &amp; <code>sf.flex_end_date</code> is variable for <code>mis.seller_org_id</code>. Need help to get the data for the <code>seller_org_id</code> for that particular <code>date range</code> only. i.e data for seller should only be available after it's a <code>start date</code> and before it's <code>end date</code> (the data is available for before start date and after end date as well, but need data between that date range and this range is different for different <code>seller_org_id</code>).</p>
  <p>Can anyone help ?</p>
  <pre><code>SELECT mis.order_id
      ,mis.order_status
      ,mis.seller_org_id
      ,mis.category
      ,mis.order_date
      ,log.rts_date
      ,log.picked_up_time
      ,sf.seller_name
      ,sf.parent_seller_org_id
      ,sf.parent_seller_name
      ,sf.seller_zone
      ,sf.seller_city
      ,sf.flex_supervisor_name
      ,sf.flex_start_date
      ,sf.flex_end_date
      ,sf.flex_status
  FROM common.mis_table mis
  LEFT JOIN logistics.logistics_data_full log ON mis.order_id = log.seller_order_id
  LEFT JOIN ds_csv_seller_flex_seller_list sf ON mis.seller_org_id = sf.seller_org_id
  WHERE mis.category NOT IN (
          'Food-FMCG'
          ,'Pharma'
          ,'Fullfilment Material'
          ,'Meat'
          ,'Fresh'
          )
      AND mis.fulfillment_center = 'FFC_SELLER'
      AND mis.order_date &gt;= '2020-07-01'
      AND mis.order_date BETWEEN sf.flex_start_date
          AND sf.flex_end_date
  </code></pre>