title: DATEDIFF displaying null values
body: <p>I have used DATEDIFF to distinguish  between when the first unit rate was created and the posting date is when the first transaction of that item was posted. 
  I have the result that I need , however the DateDiff function gives me NULL values starting date for some rows. </p>
  
  <pre><code>SELECT DISTINCT b.[Entry No_] ,
              a.[Starting Date],
              b.[Posting Date], 
              b.[Item No_],  
              b.[Invoiced Quantity],  
              a.[Litre Conversion Factor], 
              a.[Unit Rate] , 
              b.[Location Code],  
              a.[Excise Location], 
              a.[Excise Type Code], 
              a.[Unit Of Measure Code]                
  FROM [Spier Live$Value Entry] b 
  
  LEFT JOIN [Transfer Excise Tbl] a 
  
   ON a.[No_] = b.[Item No_]
    AND b.[Location Code] = a.[Location Code]
    AND DateDiff(y,b.[Posting Date],a.[Starting Date]) &gt; -365 --DateDiff Year -365 for starting date
   AND DateDiff(y,b.[Posting Date],a.[Starting Date]) &lt; 0    --DateDiff Yer &lt; 0 for posting date
   WHERE b.[Posting Date] &gt; '2013-02-26'                     --This is when the unit rate was entered
   AND b.[Gen_ Bus_ Posting Group] IN ('LOCA','EXSA')
   AND b.[Invoiced Quantity] &lt;&gt;0                             --Removing all zero values 
   AND b.[Item No_] = 'F00335' 
   ORDER BY b.[Posting Date]
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/AxjuO.jpg" rel="nofollow">My Result</a></p>
  
  <p><a href="http://i.stack.imgur.com/2HYpJ.jpg" rel="nofollow">Transfer Excise Tbl</a> This is the table I am joining on </p>