SELECTJournalentryid, Journalentryno, Capitalchain, DataSource, Entrysummary, Accountsubject, CaseAccountsubject when ' Accounts payable ' Then ' Carmen network supplier ' when ' Accounts receivable ' Then ' Carmen Customer ' when ' prepayments ' Then( Case whenJournalentryno like ' api% ' Then ' API prepaid customer ' whenJournalentryno =' CSC004 ' Then ' csc advance customer ' whenJournalentryno =' CSC005 ' Then ' Carmen Prepaid customers ' whenJournalentryno like ' kys% ' Then ' card bar 0 customers in advance ' whenJournalentryno like ' zh% ' Then ' Carmen Prepaid customers ' whenJournalentryno like ' zjc% ' Then ' Carmen Prepaid customers ' END)ELSE "' END asAccountsubjectdetail, debitamount*-1 asDebitamount, creditamount*-1 asCreditamount, Offsetcategory, Customersitetype, Businesstypeid, Journalentrytime, Inputtime fromDbo. JournalentryWHEREJournalentrytime >=' 2015-08-23 00:00:00.000 ' andJournalentrytime <=' 2015-08-23 23:59:59.999 ' andAccountsubjectinch(' Accounts receivable ',' Accounts payable ',' prepayments ') andCustomersitetype =' external site '
T-SQL case nested case