大家好,我想用这个查询的联系case句子,但有错误 6 [& m( o, a! R w4 C# CSelect CONVERT(VARCHAR(10),SII.SIDATE,103)DATE,SII.SALEID,SII.ItemName,SI.TenancyIDFROM F_SALESINVOICEITEM SIIINNER JOIN F_SALESINVOICE SI ON SI.SALEID=SII.SALEID INNER JOIN #TempTableSearch ts ON CASE WHEN ts.ACCOUNTTYPE = '1' THEN ts.ACCOUNTID=SI.TENANCYID WHEN ts.ACCOUNTTYPE='2' THEN ts.ACCOUNTID=SI.EMPLOYEEID WHEN ts.ACCOUNTTYPE='3' THEN ts.ACCOUNTID=SI.SUPPLIERID WHEN ts.ACCOUNTTYPE='4' THEN ts.ACCOUNTID=SI.SALESCUSTOMERID错误 - c0 |( w% ^; G+ i$ n9 h’=’附近的语法不正确。; K1 Y9 _' W4 @) w9 A9 L 请帮我解决这个错误。; u! `4 g! f4 z& x5 r
6 P5 P, ~; c D解决方案: $ x$ c) F7 `% q) F 它应该是, 1 i$ _; d1 w0 H( B. w* lON ts.ACCOUNTID = CASE WHEN ts.ACCOUNTTYPE = '1' THEN SI.TENANCYID WHEN ts.ACCOUNTTYPE = '2' THEN SI.EMPLOYEEID WHEN ts.ACCOUNTTYPE = '3' THEN SI.SUPPLIERID WHEN ts.ACCOUNTTYPE = '4' THEN SI.SALESCUSTOMERID END