Using Results From Case Statement in INNER JOIN statement in SQL Server 2012 -
the following query:
select u.part ,u.enddate ,f.part ,f.enddate ,(u.calc1/(case f.calc2 when 0 .00000001 else f.calc2 end)) percentrepaired ,(1-(u.calc1/(case f.calc2 when 0 .00000001 else f.calc2 end))) percentnofault ,nf.* ,r.* rccalc1part u inner join rccalc2part f on u.part = f.part , u.enddate = f.enddate inner join rcnf nf on part = left(nf.part,7) inner join repair r on nf.part = (case left(nf.part,7) when '2000000' concat(r.part,'-',left(r.extendedpart,1)) else nf.part end) order u.sn asc, nf.part asc, u.enddate asc
the following inner join concerned about:
inner join repair r on nf.part = (case left(nf.part,7) when '2000000' concat(r.part,'-',left(r.extendedpart,1)) else nf.part end)
i trying use debugger find value of right side of =
. doesn't seem doing want to. when nf. part = 2000000
want concat
r.part
, want concatenation value on right side of =
.
am doing right? if not...am far off?
thanks.
inner join repair r on nf.part = (case left(nf.part,7) when '2000000' concat(r.part,'-',left(r.extendedpart,1)) else r.part end)
looking for....everything right except column after else statement.
Comments
Post a Comment