替换LEFT OUTER JOIN中返回的空值 [英] Replace returned null values in LEFT OUTER JOIN
本文介绍了替换LEFT OUTER JOIN中返回的空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SELECT WO_BreakerRail.ID, indRailType.RailType, indRailType.RailCode, WO_BreakerRail.CreatedPieces, WO_BreakerRail.OutsideSource, WO_BreakerRail.Charged, WO_BreakerRail.Rejected, WO_BreakerRail.RejectedToCrop, WO_BreakerRail.Date
FROM indRailType LEFT OUTER JOIN
WO_BreakerRail ON indRailType.RailCode = WO_BreakerRail.RailCode AND WO_BreakerRail.Date = @date
返回时,日期"列中为NULL值,其中没有来自WO_BreakerRail的匹配行.有没有办法用@date替换那些NULL值?
When this returns, there are NULL values in the Date column where there are no matching rows from WO_BreakerRail. Is there a way to replace just those NULL values with @date?
推荐答案
在oracle和sql服务器中,您可以使用 Oracle版本)函数
In oracle and sql server, you can use the COALESCE (oracle version) function
SELECT ...., COALESCE(WO_BreakerRail.Date, @date)
这篇关于替换LEFT OUTER JOIN中返回的空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文