随笔分类 -  mysql

sql 数据合并
摘要:SELECT brid, GROUP_CONCAT(blkey) eisbn FROM jk_brxq_ygys where fl='病历' and brid='2110121794' and zycs=2 GROUP BY brid; 阅读全文

posted @ 2022-08-18 10:01 zyp_java_net 阅读(125) 评论(0) 推荐(0) 编辑

mysql 重复记录
摘要:SELECT *,_rowidFROM jk_his_zybrcryxxb aWHERE (a.brid, a.zycs,a.ryrq) IN ( SELECT brid,zycs,ryrq FROM jk_his_zybrcryxxb GROUP BY brid,zycs,ryrq HAVING 阅读全文

posted @ 2022-07-15 09:10 zyp_java_net 阅读(16) 评论(0) 推荐(0) 编辑

MySQL中删除重复数据只保留一条
摘要:DELETEFROM jk_his_zybrcryxxb aWHERE (a.brid, a.zycs,a.ryrq) IN ( select * FROM( SELECT brid, zycs,ryrq FROM jk_his_zybrcryxxb GROUP BY brid,zycs,ryrq 阅读全文

posted @ 2022-07-15 08:00 zyp_java_net 阅读(108) 评论(0) 推荐(0) 编辑

mysql找出重复数据
摘要:select brid,zycs,brxm from jk_his_zybrcryxxb group by brid,zycs,brxm having count(*)>1 阅读全文

posted @ 2022-07-14 11:14 zyp_java_net 阅读(44) 评论(0) 推荐(0) 编辑

msql replace 用法
摘要:UPDATE sys_dept SET ancestors = REPLACE ( ancestors, ',,', ',' ); 阅读全文

posted @ 2022-06-28 10:19 zyp_java_net 阅读(26) 评论(0) 推荐(0) 编辑

mysql 中sql 语句查询今天、昨天、7天、近30天、本月、上一月 数据
摘要:今天select * from 表名 where to_days(时间字段名) = to_days(now());昨天SELECT * FROM 表名 WHERE TO_DAYS( NOW( ) ) - TO_DAYS( 时间字段名) <= 17天SELECT * FROM 表名 where DAT 阅读全文

posted @ 2022-06-22 17:06 zyp_java_net 阅读(4382) 评论(0) 推荐(0) 编辑

mysql 计算两个日期的天数
摘要:update jk_his_zybrcryxxb set xse='是',nldw='天' where id in(select id FROM(select id from jk_his_zybrcryxxb where DATEDIFF( ryrq,csrq )<=28) a ) 阅读全文

posted @ 2022-06-16 08:08 zyp_java_net 阅读(171) 评论(0) 推荐(0) 编辑

mysql多表查询去重复数据_SQL重复记录查询 查询多个字段、多表查询、删除重复记录的方法...
摘要:SQL重复记录查询 1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select * from people where peopleId in (select peopleId from people group by peopleId having count(pe 阅读全文

posted @ 2022-06-15 11:05 zyp_java_net 阅读(2305) 评论(0) 推荐(0) 编辑

mysql8配置文件位置
摘要: 阅读全文

posted @ 2022-05-25 07:42 zyp_java_net 阅读(86) 评论(0) 推荐(0) 编辑

Loading local data is disabled; this must be enabled on both the client and server sides
摘要:mysql使用文件导入数据是报错: Loading local data is disabled; this must be enabled on both the client and server sides 临时解决办法: 命令行输入mysql登录命令: mysql --local-infil 阅读全文

posted @ 2022-05-17 10:22 zyp_java_net 阅读(851) 评论(0) 推荐(0) 编辑

Mysql 字符串字段判断是否包含某个字符串的3种方法
摘要:1. 方法1: INSTR函数用法 mysql 进行模糊查询时,可使用内部函数 instr,替代传统的 like 方式,并且速度更快。 instr(field, str) 函数,第一个参数 field 是字段,第二个参数 str 是要查询的串,返回串 str 的位置,没找到就是0 select * 阅读全文

posted @ 2022-05-15 22:24 zyp_java_net 阅读(735) 评论(0) 推荐(0) 编辑

mysql 获取所有父级
摘要:with recursive t as( select * from jk_his_kszdb where sid = '114' union all select a.* from jk_his_kszdb a join t on a.sid = t.parent_id)select * from 阅读全文

posted @ 2022-05-14 16:02 zyp_java_net 阅读(275) 评论(0) 推荐(0) 编辑

mysql8.0创建函数错误代码1418解决方法和原因
摘要:1、开启创建函数功能 -- 1、查看创建函数是否开启 如果Value处值为OFF,则需将其开启。show variables like '%func%';-- 2、开启MySQL函数功能set global log_bin_trust_function_creators=1;-- 3、关闭MySQL 阅读全文

posted @ 2022-05-11 10:31 zyp_java_net 阅读(253) 评论(0) 推荐(0) 编辑

MySQL统计NULL字段处理
摘要:使用COALESCE(value,…) 函数,结果和IFNULL 函数一样 阅读全文

posted @ 2022-04-27 11:39 zyp_java_net 阅读(128) 评论(0) 推荐(0) 编辑

mysql判断字段是否为汉字
摘要:mysql判断字段是否为汉字 因为汉字占两个字符所以length下一个汉字的长度为3,char_lengt的长度为1,所以比较两者计算的长度就可判断是否含有汉字 SELECT * from t_device where length(town)!=char_length(town)SELECT * 阅读全文

posted @ 2022-04-25 12:58 zyp_java_net 阅读(423) 评论(0) 推荐(0) 编辑

mysql按月统计数据
摘要:mysql按月统计数据 select DATE_FORMAT(bkrq,'%c') yf, COUNT(*) cou from bk_data where YEAR(bkrq)=YEAR(NOW()) group by MONTH(bkrq); 1.今天 SELECT * FROM 表名 WHERE 阅读全文

posted @ 2022-04-24 13:02 zyp_java_net 阅读(2489) 评论(0) 推荐(0) 编辑

修改mysql root 密码
摘要:use mysql;select host,user,authentication_string from mysql.user; flush privileges;ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'mas 阅读全文

posted @ 2022-04-01 21:27 zyp_java_net 阅读(18) 评论(0) 推荐(0) 编辑

Navicat for mysql远程连接数据库详(1130错误解决方法)
摘要:# 使用mysql 数据库mysql > use mysql;# 特定用户的host 修改mysql > update user set host='%' where user='root'; flush privileges; 阅读全文

posted @ 2022-01-17 15:29 zyp_java_net 阅读(48) 评论(0) 推荐(0) 编辑

[ERR] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'
摘要:使用navicate12运行sql文件出错 报错: [ERR] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci' 1 报错原因:生成转储文件的数据库版本为8.0,要导入sql文件的数据库版本为5.6,因为是高版本导入到低版本,引起1273错误 解决方法:打 阅读全文

posted @ 2020-10-03 10:22 zyp_java_net 阅读(123) 评论(0) 推荐(0) 编辑

Navicat 导入数据时报Incorrect datetime value: '0000-00-00 00:00:00.000000' 错误
摘要:此错误是因为Mysql5.7版本及以上版本的datetime值不能为’0000-00-00 00:00:00’, 处理方法: 1.单独导出使用了datetime字段类型,并且值有0000-00-00 00:00:00’的表,批量修改掉值在导入,此方法工作量大。 2.修改mysql.ini 在[mys 阅读全文

posted @ 2020-02-03 13:21 zyp_java_net 阅读(2025) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示