select t1.Name, t1.[Code], t2.Name as ParentName
,case when len(t2.[ParentCode]) = '' then t1.[Code] else t2.[ParentCode] end as t1.[ParentCode]
,case when len([Descr])=0 then [Code] else [Descr] end as [Descr]
,t1.[Cumulative]
,t1.[Expense]
,t1.[Accts]
,t1.[Admin]
,t1.[Assessment]
,t1.[Balance]
,t1.[Fiber]
,t1.[GL]
,t1.[LV]
,t1.[Slush]
from [KR].[pl].[Accounts] as t1
left join [KR].[pl].[Accounts] t2 on t1.ParentCode = t2.ParentCode
我想使用case語句來填寫空白列,在我使用左連接之前,它工作正常,但在我使用左連接之後,它不再工作。無論如何用左連接工作這些案件陳述?如何在使用左連接後使用case語句?
你在使用左連接之前使用了什麼?什麼不工作? – DarkKnight