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值?
在oracle和sql server中,可以使用COALESCE(oracle version)函数
SELECT ...., COALESCE(WO_BreakerRail.Date, @date)