当前位置:网站首页>SQL query, if value is null then return 1 - SQL query, if value is null then return 1

SQL query, if value is null then return 1 - SQL query, if value is null then return 1

2022-06-25 07:10:00 French red wine sweet

problem :

I have a query that is returning the exchange rate value set up in our system. I have a query to return the exchange rate value set in our system .Not every order will have an exchange rate (currate.currentrate) so it is returning null values. Not every order has an exchange rate (currate.currentrate), So it returns a null value .

Can I get it to return 1 instead of null? I can get it back 1 instead of null Do you ?

Something like an if statement maybe: similar if The thing of a statement may be :

 if isnull(currate.currentrate) then 1 else currate.currentrate 

Here is my query below. This is my query below .I greatly appreciate all your help! I really appreciate your help !

 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

Solution :

Reference resources : https://stackoom.com/en/question/10mYE
原网站

版权声明
本文为[French red wine sweet]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202201234252863.html