本文介绍了int在MySQL中转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以做这样的事情?本质上,我想将int转换为字符串,并在连接中使用该字符串.注意 %t1.id%
Is it possible to do something like this? Essentially I want to cast a int into a string and used the string on a join. Pay attention to the %t1.id%
select t2.*
from t1
join t2 on t2.url='site.com/path/%t1.id%/more'
where t1.id > 9000
推荐答案
如果您有一个名为"col1"的列,该列为int,则将其强制转换为String,如下所示:
If you have a column called "col1" which is int, you cast it to String like this:
CONVERT(col1,char)
例如这样就可以检查一个int值是否包含另一个值(此处为9),如下所示:
e.g. this allows you to check an int value is containing another value (here 9) like this:
CONVERT(col1,char) LIKE '%9%'
这篇关于int在MySQL中转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!