CASE STATEMENT在MySQL中给出了错误的结果

时间:2014-06-03 11:41:47

标签: mysql stored-procedures mysql-workbench

您好我正在使用MySQL创建一个新列并使用case语句向其中添加值但它没有提供所需的输出,例如,它为所有情况提供从1到9的值。

有人可以帮我解决上面的错误吗

  ALTER TABLE del1 ADD COLUMN VALUE FLOAT NULL;


  UPDATE del1
  SET value = (CASE 
  when brand LIKE "%RS 1 OFF%" then  1 
  when brand LIKE "%RS 2 OFF%" then  2
  when brand LIKE "%RS 3 OFF%" then  3
  when brand LIKE "%RS 4 OFF%" then  4
  when brand LIKE "%RS 5 OFF%" then  5
  when brand LIKE "%RS 6 OFF%" then  6
  when brand LIKE "%RS 7 OFF%" then  7
  when brand LIKE "%RS 8 OFF%" then  8
  when brand LIKE "%RS 9 OFF%" then  9
  when brand LIKE "%RS 10 OFF%" then  10
  when brand LIKE "%RS 11 OFF%" then  11
  when brand LIKE "%RS 12 OFF%" then  12
  when brand LIKE "%RS 13 OFF%" then  13
  when brand LIKE "%RS 14 OFF%" then  14
  when brand LIKE "%RS 15 OFF%" then  15
  when brand LIKE "%RS 16 OFF%" then  16
  when brand LIKE "%RS 17 OFF%" then  17
  when brand LIKE "%RS 18 OFF%" then  18
  when brand LIKE "%RS 19 OFF%" then  19
  when brand LIKE "%RS 20 OFF%" then  20
  when brand LIKE "%RS 21 OFF%" then  21
  when brand LIKE "%RS 22 OFF%" then  22
  when brand LIKE "%RS 23 OFF%%" then  23
  when brand LIKE "%RS 24 OFF%" then  24
  when brand LIKE "%RS 25 OFF%" then  25
  when brand LIKE "%RS 26 OFF%" then  26
  when brand LIKE "%RS 27 OFF%" then  27
  when brand LIKE "%RS 28 OFF%" then  28
  when brand LIKE "%RS 29 OFF%" then  29
  when brand LIKE "%RS 30 OFF%" then  30
  when brand LIKE "%RS 31 OFF%" then  31
  when brand LIKE "%RS 32 OFF%" then  32
  when brand LIKE "%RS 33 OFF%" then  33
  when brand LIKE "%RS 34 OFF%" then  34
  when brand LIKE "%RS 35 OFF%" then  35
  when brand LIKE "%RS 36 OFF%" then  36
  when brand LIKE "%RS 37 OFF%" then  37
  when brand LIKE "%RS 38 OFF%" then  38
  when brand LIKE "%RS 39 OFF%" then  39
  when brand LIKE "%RS 40 OFF%" then  40
  when brand LIKE "%RS 41 OFF%" then  41
  when brand LIKE "%RS 42 OFF%" then  42
  when brand LIKE "%RS 43 OFF%" then  43
  when brand LIKE "%RS 44 OFF%" then  44
  when brand LIKE "%RS 45 OFF%" then  45
  when brand LIKE "%RS 46 OFF%" then  46
  when brand LIKE "%RS 47 OFF%" then  47
  when brand LIKE "%RS 48 OFF%" then  48
  when brand LIKE "%RS 49 OFF%" then  49
  when brand LIKE "%RS 50 OFF%" then  50
  when brand LIKE "%RS 51 OFF%" then  5
  when brand LIKE "%RS1 OFF%" then  1
  when brand LIKE "%RS2 OFF%" then  2
  when brand LIKE "%RS3 OFF%" then  3
  when brand LIKE "%RS4 OFF%" then  4
  when brand LIKE "%RS5 OFF%" then  5
  when brand LIKE "%RS6 OFF%" then  6
  when brand LIKE "%RS7 OFF%" then  7
  when brand LIKE "%RS8 OFF%" then  8
  when brand LIKE "%RS9 OFF%" then  9
  when brand LIKE "%RS10 OFF%" then  10
  when brand LIKE "%RS11 OFF%" then  11
  when brand LIKE "%RS12 OFF%" then  12
  when brand LIKE "%RS13 OFF%" then  13
  when brand LIKE "%RS14 OFF%" then  14
  when brand LIKE "%RS15 OFF%" then  15
  when brand LIKE "%RS16 OFF%" then  16
  when brand LIKE "%RS17 OFF%" then  17
  when brand LIKE "%RS18 OFF%" then  18
  when brand LIKE "%RS19 OFF%" then  19
  when brand LIKE "%RS20 OFF%" then  20
  when brand LIKE "%RS21 OFF%" then  21
  when brand LIKE "%RS22 OFF%" then  22
  when brand LIKE "%RS23 OFF%" then  23
  when brand LIKE "%RS24 OFF%" then  24
  when brand LIKE "%RS25 OFF%" then  25
  when brand LIKE "%RS26 OFF%" then  26
  when brand LIKE "%RS27 OFF%" then  27
  when brand LIKE "%RS28 OFF%" then  28
  when brand LIKE "%RS29 OFF%" then  29
  when brand LIKE "%RS30 OFF%" then  30
  when brand LIKE "%RS31 OFF%" then  31
  when brand LIKE "%RS32 OFF%" then  32
  when brand LIKE "%RS33 OFF%" then  33
  when brand LIKE "%RS34 OFF%" then  34
  when brand LIKE "%RS35 OFF%" then  35
  when brand LIKE "%RS36 OFF%" then  36
  when brand LIKE "%RS37 OFF%" then  37
  when brand LIKE "%RS38 OFF%" then  38
  when brand LIKE "%RS39 OFF%" then  39
  when brand LIKE "%RS40 OFF%" then  40
  when brand LIKE "%RS41 OFF%" then  41
  when brand LIKE "%RS42 OFF%" then  42
  when brand LIKE "%RS43 OFF%" then  43
  when brand LIKE "%RS44 OFF%" then  44
  when brand LIKE "%RS45 OFF%" then  45
  when brand LIKE "%RS46 OFF%" then  46
  when brand LIKE "%RS47 OFF%" then  47
  when brand LIKE "%RS48 OFF%" then  48
  when brand LIKE "%RS49 OFF%" then  49
  when brand LIKE "%RS50 OFF%" then  50
  when brand LIKE "%RS 1OFF%" then  1
  when brand LIKE "%RS 2OFF%" then  2
  when brand LIKE "%RS 3OFF%" then  3
  when brand LIKE "%RS 4OFF%" then  4
  when brand LIKE "%RS 5OFF%" then  5
  when brand LIKE "%RS 6OFF%" then  6
  when brand LIKE "%RS 7OFF%" then  7
  when brand LIKE "%RS 8OFF%" then  8
  when brand LIKE "%RS 9OFF%" then  9
  when brand LIKE "%RS 10OFF%" then  10
  when brand LIKE "%RS 11OFF%" then  11
  when brand LIKE "%RS 12OFF%" then  12
  when brand LIKE "%RS 13OFF%" then  13
  when brand LIKE "%RS 14OFF%" then  14
  when brand LIKE "%RS 15OFF%" then  15
  when brand LIKE "%RS 16OFF%" then  16
  when brand LIKE "%RS 17OFF%" then  17
  when brand LIKE "%RS 18OFF%" then  18
  when brand LIKE "%RS 19oFF%" then  19
  when brand LIKE "%RS 20OFF%" then  20
  when brand LIKE "%RS 21OFF%" then  21
  when brand LIKE "%RS 22OFF%" then  22
  when brand LIKE "%RE 1 OFF%" then  1
  when brand LIKE "%RE 2 OFF%" then  2
  when brand LIKE "%RE 3 OFF%" then  3
  when brand LIKE "%RE 4 OFF%" then  4
  when brand LIKE "%RE 5 OFF%" then  5
  when brand LIKE "%RE 6 OFF%" then  6
  when brand LIKE "%RE 7 OFF%" then  7
  when brand LIKE "%RE 8 OFF%" then  8
  when brand LIKE "%RE 9 OFF%" then  9
  when brand LIKE "%RE 10 OFF%" then  10
  when brand LIKE "%RE 11 OFF%" then  11
  when brand LIKE "%RE 12 OFF%" then  12
  when brand LIKE "%RE 13 OFF%" then  13
  when brand LIKE "%RE 14 OFF%" then  14
  when brand LIKE "%RE 15 OFF%" then  15
  when brand LIKE "%RE 16 OFF%" then  16
  when brand LIKE "%RE 17 OFF%" then  17
  when brand LIKE "%RE 18 OFF%" then  18
  when brand LIKE "%RE 19 OFF%" then  19
  when brand LIKE "%RE 20 OFF%" then  20
  when brand LIKE "%RE 21 OFF%" then  21
  when brand LIKE "%RE 22 OFF%" then  22
  when brand LIKE "%RE 23 OFF%" then  23
  when brand LIKE "%RE 24 OFF%" then  24
  when brand LIKE "%RE 25 OFF%" then  25
  when brand LIKE "%RE 26 OFF%" then  26
  when brand LIKE "%RE 27 OFF%" then  27
  when brand LIKE "%RE 28 OFF%" then  28
  when brand LIKE "%RE 29 OFF%" then  29
  when brand LIKE "%RE 30 OFF%" then  30
  when brand LIKE "%RE 31 OFF%" then  31
  when brand LIKE "%RE 32 OFF%" then  32
  when brand LIKE "%RE 33 OFF%" then  33
  when brand LIKE "%RE 34 OFF%" then  34
  when brand LIKE "%RE 35 OFF%" then  35
  when brand LIKE "%RE 36 OFF%" then  36
  when brand LIKE "%RE 37 OFF%" then  37
  when brand LIKE "%RE 38 OFF%" then  38
  when brand LIKE "%RE 39 OFF%" then  39
  when brand LIKE "%RE 40 OFF%" then  40
  when brand LIKE "%RE 41 OFF%" then  41
  when brand LIKE "%RE 42 OFF%" then  42
  when brand LIKE "%RE 43 OFF%" then  43
  when brand LIKE "%RE 44 OFF%" then  44
  when brand LIKE "%RE 45 OFF%" then  45
  when brand LIKE "%RE 46 OFF%" then  46
  when brand LIKE "%RE 47 OFF%" then  47
  when brand LIKE "%RE 48 OFF%" then  48
  when brand LIKE "%RE 49 OFF%" then  49
  when brand LIKE "%RE 50 OFF%" then  50
  when brand LIKE "%RE 51 OFF%" then  51
  when brand LIKE "%RE 52 OFF%" then  52
  when brand LIKE "%RE 53 OFF%" then  53
  when brand LIKE "%RE 54 OFF%" then  54
  when brand LIKE "%RE 55 OFF
  when brand LIKE "%RE1 OFF%" then  1
  when brand LIKE "%RE2 OFF%" then  2
  when brand LIKE "%RE3 OFF%" then  3
  when brand LIKE "%RE4 OFF%" then  4
  when brand LIKE "%RE5 OFF%" then  5
  when brand LIKE "%RE6 OFF%" then  6
  when brand LIKE "%RE7 OFF%" then  7
  when brand LIKE "%RE8 OFF%" then  8
  when brand LIKE "%RE9 OFF%" then  9
  when brand LIKE "%RE10 OFF%" then  10
  when brand LIKE "%RE11 OFF%" then  11
  when brand LIKE "%RE12 OFF%" then  12
  when brand LIKE "%RE13 OFF%" then  13
  when brand LIKE "%RE14 OFF%" then  14
  when brand LIKE "%RE15 OFF%" then  15
  when brand LIKE "%RE16 OFF%" then  16
  when brand LIKE "%RE17 OFF%" then  17
  when brand LIKE "%RE18 OFF%" then  18
  when brand LIKE "%RE19 OFF%" then  19
  when brand LIKE "%RE20 OFF%" then  20
  when brand LIKE "%RE21 OFF%" then  21
  when brand LIKE "%RE22 OFF%" then  22
  when brand LIKE "%RE23 OFF%" then  23
  when brand LIKE "%RE24 OFF%" then  24
  when brand LIKE "%RE25 OFF%" then  25
  when brand LIKE "%RE26 OFF%" then  26
  when brand LIKE "%RE27 OFF%" then  27
  when brand LIKE "%RE28 OFF%" then  28
  when brand LIKE "%RE29 OFF%" then  29
  when brand LIKE "%RE30 OFF%" then  30
  when brand LIKE "%RE31 OFF%" then  31
  when brand LIKE "%RE32 OFF%" then  32
  when brand LIKE "%RE33 OFF%" then  33
  when brand LIKE "%RE34 OFF%" then  34
  when brand LIKE "%RE35 OFF%" then  35
  when brand LIKE "%RE36 OFF%" then  36
  when brand LIKE "%RE37 OFF%" then  37
  when brand LIKE "%RE38 OFF%" then  38
  when brand LIKE "%RE39 OFF%" then  39
  when brand LIKE "%RE40 OFF%" then  40
  when brand LIKE "%RE41 OFF%" then  41
  when brand LIKE "%RE42 OFF%" then  42
  when brand LIKE "%RE43 OFF%" then  43
  when brand LIKE "%RE44 OFF%" then  44
  when brand LIKE "%RE45 OFF%" then  45
  when brand LIKE "%RE46 OFF%" then  46
  when brand LIKE "%RE47 OFF%" then  47
  when brand LIKE "%RE48 OFF%" then  48
  when brand LIKE "%RE49 OFF%" then  49
  when brand LIKE "%RE50 OFF%" then  50
  when brand LIKE "%RE51 OFF%" then  51
  when brand LIKE "%RE52 OFF%" then  52
  when brand LIKE "%RE53 OFF%" then  53
  when brand LIKE "%RE54 OFF%" then  54
  when brand LIKE "%RE55 OFF%" then  55
  when brand LIKE "%RE56 OFF%" then  56
  when brand LIKE "%RS 1 OFF%" then  1
  when brand LIKE "%RS 1.50 OFF%" then  1.5
  when brand LIKE "%RS 2 OFF%" then  2
  when brand LIKE "%RS 2.50 OFF%" then  2.5
  when brand LIKE "%RS 3 OFF%" then  3
  when brand LIKE "%RS 3.50 OFF%" then  3.5
  when brand LIKE "%RS 4 OFF%" then  4
  when brand LIKE "%RS 4.50 OFF%" then  4.5
  when brand LIKE "%RS 5 OFF%" then  5
  when brand LIKE "%RS 5.50 OFF%" then  5.5
  when brand LIKE "%RS 6 OFF%" then  6
  when brand LIKE "%RS 6.50 OFF%" then  6.5
  when brand LIKE "%RS 7 OFF%" then  7
  when brand LIKE "%RS 7.50 OFF%" then  7.5
  when brand LIKE "%RS 8 OFF%" then  8
  when brand LIKE "%RS 8.50 OFF%" then  8.5
  when brand LIKE "%RS 9 OFF%" then  9
  when brand LIKE "%RS 9.50 OFF%" then  9.5
  when brand LIKE "%RS 10 OFF%" then  10
  when brand LIKE "%RS 10.50 OFF%" then  10.5
  when brand LIKE "%RS 10.5OFF%" then  10.5
  when brand LIKE "%RS 11 OFF%" then  11
  when brand LIKE "%RS 11.50 OFF%" then  11.5
  when brand LIKE "%RS 12 OFF%" then  12
  when brand LIKE "%RS 12.50 OFF%" then  12.5
  when brand LIKE "%RS 13 OFF%" then  13
  when brand LIKE "%RS 13.50 OFF%" then  13.5
  when brand LIKE "%RS 14 OFF%" then  14
  when brand LIKE "%RS 14.50 OFF%" then  14.5
  when brand LIKE "%RS 15 OFF%" then  15
  when brand LIKE "%RS 15.50 OFF%" then  15.5
  when brand LIKE "%RS 16 OFF%" then  16
  when brand LIKE "%RS 16.50 OFF%" then  16.5
  when brand LIKE "%RS 17 OFF%" then  17
  when brand LIKE "%RS 17.50 OFF%" then  17.5
  when brand LIKE "%RS 18 OFF%" then  18
  when brand LIKE "%RS 18.50 OFF%" then  18.5
  when brand LIKE "%RS 19 OFF%" then  19
  when brand LIKE "%RS 19.50 OFF%" then  19.5
  when brand LIKE "%RS 20 OFF%" then  20
  when brand LIKE "%RS 20.50 OFF%" then  20.5
  when brand LIKE "%RS 21 OFF%" then  21
  when brand LIKE "%RS 21.50 OFF%" then  21.5
  when brand LIKE "%RS 22 OFF%" then  22
  when brand LIKE "%RS 22.50 OFF%" then  22.5
  when brand LIKE "%RS 23 OFF%" then  23
  when brand LIKE "%RS 23.50 OFF%" then  23.5
  when brand LIKE "%RS 24 OFF%" then  24
  when brand LIKE "%RS 24.50 OFF%" then  24.5
  when brand LIKE "%RS 25 OFF%" then  25
  when brand LIKE "%RS 25.50 OFF%" then  25.5
  when brand LIKE "%RS 26 OFF%" then  26
  when brand LIKE "%RS 26.50 OFF%" then  26.5
  when brand LIKE "%RS 27 OFF%" then  27
  when brand LIKE "%RS 27.50 OFF%" then  27.5
  when brand LIKE "%RS 28 OFF%" then  28
  when brand LIKE "%RS 28.50 OFF%" then  28.5
  when brand LIKE "%RS 29 OFF%" then  29
  when brand LIKE "%RS 29.50 OFF%" then  29.5
  when brand LIKE "%RS 30 OFF%" then  30
  when brand LIKE "%RS 30.50 OFF%" then  30.5
  when brand LIKE "%RS 31 OFF%" then  31
  when brand LIKE "%RS 31.50 OFF%" then  31.5
  when brand LIKE "%RS 32 OFF%" then  32
  when brand LIKE "%RS 32.50 OFF%" then  32.5
  when brand LIKE "%RS 33 OFF%" then  33
  when brand LIKE "%RS 33.50 OFF%" then  33.5
  when brand LIKE "%RS 34 OFF%" then  34
  when brand LIKE "%RS 34.50 OFF%" then  34.5
  when brand LIKE "%RS 35 OFF%" then  35
  when brand LIKE "%RS 35.50 OFF%" then  35.5
  when brand LIKE "%RS 36 OFF%" then  36
  when brand LIKE "%RS 36.50 OFF%" then  36.5
  when brand LIKE "%RS 37 OFF%" then  37
  when brand LIKE "%RS 37.50 OFF%" then  37.5
  when brand LIKE "%RS 38 OFF%" then  38
  when brand LIKE "%RS 38.50 OFF%" then  38.5
  when brand LIKE "%RS 39 OFF%" then  39
  when brand LIKE "%RS 39.50 OFF%" then  39.5
  when brand LIKE "%RS 40 OFF%" then  40
  when brand LIKE "%RS 40.50 OFF%" then  40.5
  when brand LIKE "%RS 41 OFF%" then  41
  when brand LIKE "%RS 41.50 OFF%" then  41.5
  when brand LIKE "%RS 42 OFF%" then  42
  when brand LIKE "%RS 42.50 OFF%" then  42.5
  when brand LIKE "%RS 43 OFF%" then  43
  when brand LIKE "%RS 43.50 OFF%" then  43.5
  when brand LIKE "%RS 44 OFF%" then  44
  when brand LIKE "%RS 44.50 OFF%" then  44.5
  when brand LIKE "%RS 45 OFF%" then  45
  when brand LIKE "%RS 45.50 OFF%" then  45.5
  when brand LIKE "%RS 46 OFF%" then  46
  when brand LIKE "%RS 46.50 OFF%" then  46.5
  when brand LIKE "%RS 47 OFF%" then  47
  when brand LIKE "%RS 47.50 OFF%" then  47.5
  when brand LIKE "%RS 48 OFF%" then  48
  when brand LIKE "%RS 48.50 OFF%" then  48.5
  when brand LIKE "%RS 49 OFF%" then  49
  when brand LIKE "%RS 49.50 OFF%" then  49.5
  when brand LIKE "%RS 50 OFF%" then  50
  when brand LIKE "%RS 50.50 OFF%" then  50.5
  when brand LIKE "%RS.1 OFF%" then  1
  when brand LIKE "%RS.2 OFF%" then  2
  when brand LIKE "%RS.3 OFF%" then  3
  when brand LIKE "%RS.4 OFF%" then  4
  when brand LIKE "%RS.5 OFF%" then  5
  when brand LIKE "%RS.6 OFF%" then  6
  when brand LIKE "%RS.7 OFF%" then  7
  when brand LIKE "%RS.8 OFF%" then  8
  when brand LIKE "%RS.9 OFF%" then  9
  when brand LIKE "%RS.10 OFF%" then  10
  when brand LIKE "%RS.11 OFF%" then  11
  when brand LIKE "%RS.12 OFF%" then  12
  when brand LIKE "%RS.13 OFF%" then  13
  when brand LIKE "%RS.14 OFF%" then  14
  when brand LIKE "%RS.15 OFF%" then  15
  when brand LIKE "%RS.16 OFF%" then  16
  when brand LIKE "%RS.17 OFF%" then  17
  when brand LIKE "%RS.18 OFF%" then  18
  when brand LIKE "%RS.19 OFF%" then  19
  when brand LIKE "%RS.20 OFF%" then  20
  when brand LIKE "%RS.21 OFF%" then  21
  when brand LIKE "%RS.22 OFF%" then  22
  when brand LIKE "%RS.23 OFF%" then  23
  when brand LIKE "%RS.24 OFF%" then  24
  when brand LIKE "%RS.25 OFF%" then  25
  when brand LIKE "%RS.26 OFF%" then  26
  when brand LIKE "%RS.27 OFF%" then  27
  when brand LIKE "%RS.28 OFF%" then  28
  when brand LIKE "%RS.29 OFF%" then  29
  when brand LIKE "%RS.30 OFF%" then  30
  when brand LIKE "%RS.31 OFF%" then  31
  when brand LIKE "%RS.32 OFF%" then  32
  when brand LIKE "%RS.33 OFF%" then  33
  when brand LIKE "%RS.34 OFF%" then  34
  when brand LIKE "%RS.35 OFF%" then  35
  when brand LIKE "%RS.36 OFF%" then  36
  when brand LIKE "%RS.37 OFF%" then  37
  when brand LIKE "%RS.38 OFF%" then  38
  when brand LIKE "%RS.39 OFF%" then  39
  when brand LIKE "%RS.40 OFF%" then  40
  when brand LIKE "%RS.41 OFF%" then  41
  when brand LIKE "%RS.42 OFF%" then  42
  when brand LIKE "%RS.43 OFF%" then  43
  when brand LIKE "%RS.44 OFF%" then  44
  when brand LIKE "%RS.45 OFF%" then  45
  when brand LIKE "%RS.46 OFF%" then  46
  when brand LIKE "%RS.47 OFF%" then  47
  when brand LIKE "%RS.48 OFF%" then  48
  when brand LIKE "%RS.49 OFF%" then  49
  when brand LIKE "%RS.50 OFF%" then  50
  when brand LIKE "%RS. 1 OFF%" then  1
  when brand LIKE "%RS. 2 OFF%" then  2
  when brand LIKE "%RS. 3 OFF%" then  3
  when brand LIKE "%RS. 4 OFF%" then  4
  when brand LIKE "%RS. 5 OFF%" then  5
  when brand LIKE "%RS. 6 OFF%" then  6
  when brand LIKE "%RS. 7 OFF%" then  7
  when brand LIKE "%RS. 8 OFF%" then  8
  when brand LIKE "%RS. 9 OFF%" then  9
  when brand LIKE "%RS. 10 OFF%" then  10
  when brand LIKE "%RS. 11 OFF%" then  11
  when brand LIKE "%RS. 12 OFF%" then  12
  when brand LIKE "%RS. 13 OFF%" then  13
  when brand LIKE "%RS. 14 OFF%" then  14
  when brand LIKE "%RS. 15 OFF%" then  15
  when brand LIKE "%RS. 16 OFF%" then  16
  when brand LIKE "%RS. 17 OFF%" then  17
  when brand LIKE "%RS. 18 OFF%" then  18
  when brand LIKE "%RS. 19 OFF%" then  19
  when brand LIKE "%RS. 20 OFF%" then  20
  when brand LIKE "%RS. 21 OFF%" then  21
  when brand LIKE "%RS. 22 OFF%" then  22
  when brand LIKE "%RS. 23 OFF%" then  23
  when brand LIKE "%RS. 24 OFF%" then  24
  when brand LIKE "%RS. 25 OFF%" then  25
  when brand LIKE "%RS. 26 OFF%" then  26
  when brand LIKE "%RS. 27 OFF%" then  27
  when brand LIKE "%RS. 28 OFF%" then  28
  when brand LIKE "%RS. 29 OFF%" then  29
  when brand LIKE "%RS. 30 OFF%" then  30
  when brand LIKE "%RS. 31 OFF%" then  31
  when brand LIKE "%RS. 32 OFF%" then  32
  when brand LIKE "%RS. 33 OFF%" then  33
  when brand LIKE "%RS. 34 OFF%" then  34
  when brand LIKE "%RS. 35 OFF%" then  35
  when brand LIKE "%RS. 36 OFF%" then  36
  when brand LIKE "%RS. 37 OFF%" then  37
  when brand LIKE "%RS. 38 OFF%" then  38
  when brand LIKE "%RS. 39 OFF%" then  39
  when brand LIKE "%RS. 40 OFF%" then  40
  when brand LIKE "%RS. 41 OFF%" then  41
  when brand LIKE "%RS. 42 OFF%" then  42
  when brand LIKE "%RS. 43 OFF%" then  43
  when brand LIKE "%RS. 44 OFF%" then  44
  when brand LIKE "%RS. 45 OFF%" then  45
  when brand LIKE "%RS. 46 OFF%" then  46
  when brand LIKE "%RS. 47 OFF%" then  47
  when brand LIKE "%RS. 48 OFF%" then  48
  when brand LIKE "%RS. 49 OFF%" then  49
  when brand LIKE "%RS. 50 OFF%" then  50
  when brand LIKE "%RS.1/-OFF%" then  1
  when brand LIKE "%RS.2/-OFF%" then  2
  when brand LIKE "%RS.3/-OFF%" then  3
  when brand LIKE "%RS.4/-OFF%" then  4
  when brand LIKE "%RS.5/-OFF%" then  5
  when brand LIKE "%RS.6/-OFF%" then  6
  when brand LIKE "%RS.7/-OFF%" then  7
  when brand LIKE "%RS.8/-OFF%" then  8
  when brand LIKE "%RS.9/-OFF%" then  9
  when brand LIKE "%RS.10/-OFF%" then  10
  when brand LIKE "%RS.11/-OFF%" then  11
  when brand LIKE "%RS.12/-OFF%" then  12
  when brand LIKE "%RS.13/-OFF%" then  13
  when brand LIKE "%RS.14/-OFF%" then  14
  when brand LIKE "%RS.15/-OFF%" then  15
  when brand LIKE "%RS.16/-OFF%" then  16
  when brand LIKE "%RS.17/-OFF%" then  17
  when brand LIKE "%RS.18/-OFF%" then  18
  when brand LIKE "%RS.19/-OFF%" then  19
  when brand LIKE "%RS.20/-OFF%" then  20
  when brand LIKE "%RS.21/-OFF%" then  21
  when brand LIKE "%RS.22/-OFF%" then  22
  when brand LIKE "%RS.23/-OFF%" then  23
  when brand LIKE "%RS.24/-OFF%" then  24
  when brand LIKE "%RS.25/-OFF%" then  25
  when brand LIKE "%RS.26/-OFF%" then  26
  when brand LIKE "%RS.27/-OFF%" then  27
  when brand LIKE "%RS.28/-OFF%" then  28
  when brand LIKE "%RS.29/-OFF%" then  29
  when brand LIKE "%RS.30/-OFF%" then  30
  when brand LIKE "%RS.31/-OFF%" then  31
  when brand LIKE "%RS.32/-OFF%" then  32
  when brand LIKE "%RS.33/-OFF%" then  33
  when brand LIKE "%RS.34/-OFF%" then  34
  when brand LIKE "%RS.35/-OFF%" then  35
  when brand LIKE "%RS.36/-OFF%" then  36
  when brand LIKE "%RS.37/-OFF%" then  37
  when brand LIKE "%RS.38/-OFF%" then  38
  when brand LIKE "%RS.39/-OFF%" then  39
  when brand LIKE "%RS.40/-OFF%" then  40
  when brand LIKE "%RS.41/-OFF%" then  41
  when brand LIKE "%RS.42/-OFF%" then  42
  when brand LIKE "%RS.43/-OFF%" then  43
  when brand LIKE "%RS.44/-OFF%" then  44
  when brand LIKE "%RS.45/-OFF%" then  45
  when brand LIKE "%RS.46/-OFF%" then  46
  when brand LIKE "%RS.47/-OFF%" then  47
  when brand LIKE "%RS.48/-OFF%" then  48
  when brand LIKE "%RS.49/-OFF%" then  49
  when brand LIKE "%RS.50/-OFF%" then  50
  when brand LIKE "%RS. 1/-OFF%" then  1
  when brand LIKE "%RS. 2/-OFF%" then  2
  when brand LIKE "%RS. 3/-OFF%" then  3
  when brand LIKE "%RS. 4/-OFF%" then  4
  when brand LIKE "%RS. 5/-OFF%" then  5
  when brand LIKE "%RS. 6/-OFF%" then  6
  when brand LIKE "%RS. 7/-OFF%" then  7
  when brand LIKE "%RS. 8/-OFF%" then  8
  when brand LIKE "%RS. 9/-OFF%" then  9
  when brand LIKE "%RS. 10/-OFF%" then  10
  when brand LIKE "%RS. 11/-OFF%" then  11
  when brand LIKE "%RS. 12/-OFF%" then  12
  when brand LIKE "%RS. 13/-OFF%" then  13
  when brand LIKE "%RS. 14/-OFF%" then  14
  when brand LIKE "%RS. 15/-OFF%" then  15
  when brand LIKE "%RS. 16/-OFF%" then  16
  when brand LIKE "%RS. 17/-OFF%" then  17
  when brand LIKE "%RS. 18/-OFF%" then  18
  when brand LIKE "%RS. 19/-OFF%" then  19
  when brand LIKE "%RS. 20/-OFF%" then  20
  when brand LIKE "%RS. 21/-OFF%" then  21
  when brand LIKE "%RS. 22/-OFF%" then  22
  when brand LIKE "%RS. 23/-OFF%" then  23
  when brand LIKE "%RS. 24/-OFF%" then  24
  when brand LIKE "%RS. 25/-OFF%" then  25
  when brand LIKE "%RS. 26/-OFF%" then  26
  when brand LIKE "%RS. 27/-OFF%" then  27
  when brand LIKE "%RS. 28/-OFF%" then  28
  when brand LIKE "%RS. 29/-OFF%" then  29
  when brand LIKE "%RS. 30/-OFF%" then  30
  when brand LIKE "%RS. 31/-OFF%" then  31
  when brand LIKE "%RS. 32/-OFF%" then  32
  when brand LIKE "%RS. 33/-OFF%" then  33
  when brand LIKE "%RS. 34/-OFF%" then  34
  when brand LIKE "%RS. 35/-OFF%" then  35
  when brand LIKE "%RS. 36/-OFF%" then  36
  when brand LIKE "%RS. 37/-OFF%" then  37
  when brand LIKE "%RS. 38/-OFF%" then  38
  when brand LIKE "%RS. 39/-OFF%" then  39
  when brand LIKE "%RS. 40/-OFF%" then  40
  when brand LIKE "%RS. 41/-OFF%" then  41
  when brand LIKE "%RS. 42/-OFF%" then  42
  when brand LIKE "%RS. 43/-OFF%" then  43
  when brand LIKE "%RS. 44/-OFF%" then  44
  when brand LIKE "%RS. 45/-OFF%" then  45
  when brand LIKE "%RS. 46/-OFF%" then  46
  when brand LIKE "%RS. 47/-OFF%" then  47
  when brand LIKE "%RS. 48/-OFF%" then  48
  when brand LIKE "%RS. 49/-OFF%" then  49
  when brand LIKE "%RS. 50/-OFF%" then  50
  when brand LIKE "%RS. 1/- OFF%" then  1
  when brand LIKE "%RS. 2/- OFF%" then  2
  when brand LIKE "%RS. 3/- OFF%" then  3
  when brand LIKE "%RS. 4/- OFF%" then  4
  when brand LIKE "%RS. 5/- OFF%" then  5
  when brand LIKE "%RS. 6/- OFF%" then  6
  when brand LIKE "%RS. 7/- OFF%" then  7
  when brand LIKE "%RS. 8/- OFF%" then  8
  when brand LIKE "%RS. 9/- OFF%" then  9
  when brand LIKE "%RS. 10/- OFF%" then  10
  when brand LIKE "%RS. 11/- OFF%" then  11
  when brand LIKE "%RS. 12/- OFF%" then  12
  when brand LIKE "%RS. 13/- OFF%" then  13
  when brand LIKE "%RS. 14/- OFF%" then  14
  when brand LIKE "%RS. 15/- OFF%" then  15
  when brand LIKE "%RS. 16/- OFF%" then  16
  when brand LIKE "%RS. 17/- OFF%" then  17
  when brand LIKE "%RS. 18/- OFF%" then  18
  when brand LIKE "%RS. 19/- OFF%" then  19
  when brand LIKE "%RS. 20/- OFF%" then  20
  when brand LIKE "%RS. 21/- OFF%" then  21
  when brand LIKE "%RS. 22/- OFF%" then  22
  when brand LIKE "%RS. 23/- OFF%" then  23
  when brand LIKE "%RS. 24/- OFF%" then  24
  when brand LIKE "%RS. 25/- OFF%" then  25
  when brand LIKE "%RS. 26/- OFF%" then  26
  when brand LIKE "%SAVE RS.1%" then  1
  when brand LIKE "%SAVE RS.2%" then  2
  END
  );

1 个答案:

答案 0 :(得分:0)

根据Stack Overflow中的语法高亮显示,以下行:

 when brand LIKE "%RE 55 OFF

缺少终止报价。它应该是:

 when brand LIKE "%RE 55 OFF" then 55 <-- My guess as to the value

此外,单引号优于双引号(例如,单引号是字符串常量的SQL标准)。

编辑:

如果我想做你想做的事,你可能想要考虑这个结构:

substring_index(substring_index(brand, ' OFF', 1), ' ', -1) + 0

这可能会替换整个case语句(取决于数据的真实情况,但它可能有效)。