💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
14.6.5.1 CASE Syntax ~~~ CASE case_value WHEN when_value THEN statement_list [WHEN when_value THEN statement_list] ... [ELSE statement_list] END CASE ~~~ Or: ~~~ CASE WHEN search_condition THEN statement_list [WHEN search_condition THEN statement_list] ... [ELSE statement_list] END CASE ~~~ 用例 ~~~ SELECT EmployeeID, NAME, Address, CASE WHEN DepartmentID = '1' THEN '财务部' WHEN DepartmentID = '2' THEN '人力资源部' WHEN DepartmentID = '3' THEN '经理办公室' WHEN DepartmentID = '4' THEN '研发部' WHEN DepartmentID = '5' THEN '市场部' END CASE AS DepartmentID FROM Employees ~~~ * * * * * https://dev.mysql.com/doc/refman/5.7/en/case.html