Select SUBSTR(t1.row,1,1)-(t2.row,1, 1)|| SUBSTR(t1.row,2,2)-SUBSTR(t2.row,2, 2)||... so on from table t1 where t1.row NOT IN (Select row in table t2); 这将在同一个表中检查行是否存在,如果不逐位减去它将跳过,或者您可以在pl/sql中使用loop,方法是将substr的值声明为i,j表示两者,然后减去。
select GROUP_CONCAT(CAST(ABS(substring('123456782',c.count,1)-substring('323456789',c.count,1)) AS CHAR) separator '')
from (select c1.1*10+c2.1 count from (select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 0) c1,
(select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 0) c2 order by count) c
where c.count>0 and c.count<=length('123456782')
2条答案
按热度按时间klsxnrf11#
Select SUBSTR(t1.row,1,1)-(t2.row,1, 1)|| SUBSTR(t1.row,2,2)-SUBSTR(t2.row,2, 2)||... so on from table t1 where t1.row NOT IN (Select row in table t2);
这将在同一个表中检查行是否存在,如果不逐位减去它将跳过,或者您可以在pl/sql中使用loop,方法是将substr的值声明为i,j表示两者,然后减去。zpf6vheq2#
2字符串的长度相同,最后一个参数是字符串的长度