博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql 两张表字段模糊匹配--字符串拼接函数
阅读量:6879 次
发布时间:2019-06-26

本文共 487 字,大约阅读时间需要 1 分钟。

concat(A,B,C,...)  拼接字符串

例如concat('123','***','345')  =>123***345

SELECT    concat(        substr(t1.CODE, 1, 3),        '****',        substr(t1.CODE, 8)    ),    t1.CODE,    t2.TITLEFROM    table1 t1LEFT JOIN table2 t2 ON t1.table2id = t2.idWHERE    t1..CREATEDATE >= '2016-07-19 00:00:00'AND t1.CREATEDATE <= '2016-07-19 23:59:59';

两张表字段模糊匹配,进行数据更新:

update tb1 join tb2 on tb1.a like concat('%',tb2.a,'%')set tb1.xx=tb2.xxwhere xxx;

 

转载于:https://www.cnblogs.com/jwanqiang/p/10267252.html

你可能感兴趣的文章