- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
select model,(CAST(substring(model, 1, 1) as int)+CAST(substring(model, 2, 1) as int)+CAST(substring(model, 3, 1) as int)+CAST(substring(model, 4, 1) as int)) as qty
from product
where
(substring(model, 1, 1) like '0' or substring(model, 1, 1) like '1' or substring(model, 1, 1) like '2'
or substring(model, 1, 1) like '3' or substring(model, 1, 1) like '4' or substring(model, 1, 1) like '5'
or substring(model, 1, 1) like '6' or substring(model, 1, 1) like '7' or substring(model, 1, 1) like '8'
or substring(model, 1, 1) like '9')
AND (substring(model, 2, 1) like '0' or substring(model, 2, 1) like '1' or substring(model, 2, 1) like '2'
or substring(model, 2, 1) like '3' or substring(model, 2, 1) like '4' or substring(model, 2, 1) like '5'
or substring(model, 2, 1) like '6' or substring(model, 2, 1) like '7' or substring(model, 2, 1) like '8'
or substring(model, 2, 1) like '9')
AND (substring(model, 3, 1) like '0' or substring(model, 3, 1) like '1' or substring(model, 3, 1) like '2'
or substring(model, 3, 1) like '3' or substring(model, 3, 1) like '4' or substring(model, 3, 1) like '5'
or substring(model, 3, 1) like '6' or substring(model, 3, 1) like '7' or substring(model, 3, 1) like '8'
or substring(model, 3, 1) like '9')
AND (substring(model, 4, 1) like '0' or substring(model, 4, 1) like '1' or substring(model, 4, 1) like '2'
or substring(model, 4, 1) like '3' or substring(model, 4, 1) like '4' or substring(model, 4, 1) like '5'
or substring(model, 4, 1) like '6' or substring(model, 4, 1) like '7' or substring(model, 4, 1) like '8'
or substring(model, 4, 1) like '9')
select model,
ASCII(SUBSTRING(model,1,1))+
ASCII(SUBSTRING(model,2,1))+
ASCII(SUBSTRING(model,3,1))+
ASCII(SUBSTRING(model,4,1))
-48*4 as qty from Product
тоже не помогло.
sql ex рейтинговое 4. показывает что на тренировочной что-то не правильно.
лайк же вроде проверяет '1' как цифру а не как строку.
любые хинты как тут
Комментарии (0) RSS
Добавить комментарий