title: Linq to SQL dealing with nullable value
body: <p>I have a legacy SQL script that join prob_contact table with other tables by comparing number of days with date range low_amt and high_amt. This work perfectly fine with SQL.</p>
  
  <p><code>JOIN prob_contact p ON (s.end_date - s.start_date) BETWEEN p.low_amt AND p.high_amt</code></p>
  
  <p>I want to convert the SQL script to Linq, but I'm having an issue on nullable TimeSpan? Please let me know if there is a solution for this problem.</p>
  
  <p><code>let d = s.End_date - s.Start_date</code></p>
  
  <pre><code>Original T-SQL Command (datasource Oracle 12c by Joan Casteel)
  
  SELECT (c.last + ', ' + c.first) AS name, s.start_date, s.end_date, p.con_freq
    FROM dbo.criminals c INNER JOIN dbo.sentences s ON c.criminal_id = s.criminal_id
         INNER JOIN dbo.prob_officers o ON o.prob_id = s.prob_id
         JOIN prob_contact p ON (s.end_date - s.start_date) BETWEEN p.low_amt AND p.high_amt
    ORDER BY name, s.start_date;
  </code></pre>
  
  <pre><code>Linqpad script
  
  var result = from c in Criminals 
                  join s in Sentences on c.Criminal_id equals s.Criminal_id
                  let d = s.End_date - s.Start_date
                  from p in Prob_contacts where d &lt; p.Low_amt
                  orderby c.Last
                  select new  {
                      name = c.Last + ", " + c.First,
                      startDate = s.Start_date,
                      freq = p.Con_freq,
                      d
                  };
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Tu04S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tu04S.png" alt="Linq command on LinqPad"></a></p>