sql 查询结果格式化

有时候 我们需要对查询结果进行比较

如果值是 A ,则 返回A

如果值是B,则返回BB

以下sql在mysql中测试通过

select 
id,
monitor_rule_name,
monitor_rule_condition,

CASE monitor_rule_condition
	when  'lt' then '<'
	when  'gt' then '>'
	when  'eq' then '>'
end 

as newColumn

from monitor_config_rule_monitor 

猜你喜欢

转载自woxiangbo.iteye.com/blog/1867507