title: SQL query, if value is null then return 1
body: <p>I have a query that is returning the exchange rate value set up in our system. Not every order will have an exchange rate (currate.currentrate) so it is returning null values. </p>
  
  <p>Can I get it to return 1 instead of null?</p>
  
  <p>Something like an if statement maybe:</p>
  
  <pre><code> if isnull(currate.currentrate) then 1 else currate.currentrate 
  </code></pre>
  
  <p>Here is my query below.  I greatly appreciate all your help!</p>
  
  <pre><code> SELECT     orderhed.ordernum, orderhed.orderdate, currrate.currencycode,  currrate.currentrate
   FROM         orderhed LEFT OUTER JOIN
                    currrate ON orderhed.company = currrate.company AND orderhed.orderdate = currrate.effectivedate
  </code></pre>