MySQL Case in Select Statement with LIKE operator

后端 未结 4 1444
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 13:32

Is it possible to combine the CASE statement and the LIKE operator in a MySQL SELECT statement?

For Example, I am trying to query

4条回答
  •  借酒劲吻你
    2021-02-01 13:35

    Assuming the number of digits is constant, you could use something like this:

    SELECT IF(digits > 919999, MOD(digits, 100), MOD(digits, 10000) FROM raw
    

    Add 0's to match your actual number of digits.

提交回复
热议问题