case function, replace function

(Case 'field'

when 'data 1' the then 'output 1'

when 'data 2' the then 'output 2'

when 'Data 3' the then 'output 3'

else 'consistent with other data output'

end) as 'field'

replace (field, 'atom string', 'new substring') as field

username the SELECT,
(Case `role`
the when the then 0 'monitor'
the when the then 1 'class representatives'
the when the then 2 'leader'
the when the then 3 'student'
the else 'Super administrator'
End) AS 'Role',
the replace (the replace (Replace (Replace (Replace (Replace (Replace (Replace (Replace (Replace (
Replace (Replace (Replace (Replace (Replace (Replace (user_condition, '10 ',' language J '),
'. 11 ',' language k ') , '12 ',' language l '),' 13 ', ' language m '),' 14 ', ' language n '),' 15 ', ' language o '),' 16 ', ' language p ') , '1', 'language A'),
'2', 'language b'), '3', ' language c'), '4', ' language d'), '5', ' language e') , '6', 'language f'), '7', ' language g'), '8', ' language h),' 9 ','语文i')
as user_condition from loginuser a, user_menu b where a.id = b.UserId and region = 999;

 Raw data query:

 After modifying the query:

 

Guess you like

Origin www.cnblogs.com/likaixin/p/11264400.html