1. 数据库when/then的使用问题
else 就返回id 字符串的第二位开始,到倒数第二位结束的字符串。
2. 数据库 case when then
select case type when 1 then 'g' else 'n' end from SalaryPayDate
3. access数据库中有类似sql server的case when then的语句吗
Access 没有 case when
但是有一个抄 iif 函数可袭以处理。
SQL Server:
select bb,cc,case aa when '一星级' then '*'
when '二星级' then '** '
when '三星级' then '*** '
when '四星级' then '**** '
when '五星级' then '***** '
end
from aaa
Access:
select bb,cc,iif(aa='一星级','*',iif(aa='二星级','**',iif(aa='三星级','***',iif(aa='四星级','****',iif(aa='五星级','*****'))))) from aaa;