Home > database >  SQL query result different values in a column batch replacement
SQL query result different values in a column batch replacement

Time:10-13

Refer to the
If some of the query result at the beginning of a list of phone values, such as "137", "138", "130"... Want to replace it: "China mobile", "China mobile", "China unicom"...
Replace a can only replace a replacement, how all batch replace?

CodePudding user response:

The case when make better

CodePudding user response:

reference 1st floor weixin_42706334 response:
case when make better
thank you very much! This is, when touching now to think the problem look weak chicken. I have already solved. Do use case the when. When there is a batch number, such as mobile there will be 135/136/137/138... Them roughly very much, so use is
 case when mid (mobile phone number, 1, 3) in (' 135 ', '136' '... '... ) then 'China mobile... 

Now have learned to use the function with another parameter table to convert the better way. Thank you very much!
  • Related