sql截取字段中一部分值

376 阅读1分钟

sql截取字段中一部分值

查出表中reportDept 字段倒数两位的内容不等于"天津"的内容

select *
from (select  reportDept from emp) re
where 
SUBSTRING(re.reportDept,-2) !='天津'

截取表中reportDept 字段倒数两位的内容,并把结果查出来

select SUBSTRING(re.reportDept,-2)
from (select  reportDept from emp) re

其他

自己建立了一个技术群,大家愿意主动学习和分享,愿意一块实现一些有意思的技术,进行理论和实践的交流。这里面有前端和后段,不是单一的一种,方便大家沟通前后端兼容问题 image.png