比如查询gene_bjcovid_user 样本编号sample_number 是否包含空格。
select * from gene_bjcovid_user where id not in (select id from gene_bjcovid_user where sample_number NOT LIKE '% %');
如果需要去除空格:
update `gene_bjcovid_user` set `sample_number`=replace(`sample_number`,' ','')
CREATE TEMPORARY TABLE tmp_name AS SELECT * FROM gene_bjcovid_idcard;
TRUNCATE table gene_bjcovid_idcard;
INSERT gene_bjcovid_idcard(sfz,createdate,modifydate)
SELECT sfz,createdate,modifydate FROM tmp_name;
DROP TABLE tmp_name;
ALTER TABLE 表名 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
2023-04-23 17:20:47 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-04-23 17:20:47 0 [Note] Server socket created on IP: '::'.
解决方法:
1. 拷贝backup目录的所有索引文件。
2. 备份/data/ibdata1 文件,
3. 然后把backup目录相关文件拷贝到data目录覆盖
4. 最后恢复ibdata1文件,重新启动mysql。
thinkphp 高级mysql 查询语法:
数据库高级查询