SQL query – if value is null then return 1

The example from Stackoverflow.

SELECT  orderhed.ordernum, 
    orderhed.orderdate, 
    currrate.currencycode,  
    coalesce(currrate.currentrate, 1) as currentrate
FROM orderhed 
LEFT OUTER JOIN currrate 
    ON orderhed.company = currrate.company 
    AND orderhed.orderdate = currrate.effectivedate

http://stackoverflow.com/questions/14962970/sql-query-if-value-is-null-then-return-1

Leave a Reply

Your email address will not be published. Required fields are marked *

*