首页
友链
统计
留言
关于
Search
1
网站声明
55 阅读
2
Java生成二维码——基于Google插件
55 阅读
3
Java使用poi-tl动态生成word和pdf
36 阅读
4
循环单链表及其实现
31 阅读
5
双链表及其实现
31 阅读
默认分类
Java
C语言
数据库技术
Linux
前端
其他
登录
/
注册
Search
标签搜索
C语言
数据结构
Java
Spring
数据库技术
MySQL
设计模式
策略模式
工厂模式
IDEA
SpringMVC
AOP
MybatisPlus
POI
easyExcel
LiXiangrong
累计撰写
56
篇文章
累计收到
4
条评论
首页
栏目
默认分类
Java
C语言
数据库技术
Linux
前端
其他
页面
友链
统计
留言
关于
搜索到
2
篇与
的结果
2024-01-03
MySQL笔记
1.group_concat函数支持order by内部排序,例如:# 按照id倒序拼接img SELECT GROUP_CONCAT(img ORDER BY id DESC) FROM `thumb_table`;2.Mysql 给查询出的结果集添加自增序号SELECT (@rownum:=@rownum+1) 自增序号别名, 结果集字段 FROM 结果集, (SELECT @rownum:=0) AS 任意别名 SELECT @rownum:=@rownum+1 AS rownum, A.* FROM ( SELECT U.* FROM `users` U ORDER BY U.`id` DESC ) A, (SELECT @rownum:=0) B补充: 如果是在MyBatis中使用上述查询时,变量i的的初始值0,可以使用传参的方式(${})进行设置。3.mysql日期加一天select DATE_ADD('2022-02-24 09:03:36',INTERVAL 1 DAY);4.距离计算函数<select id="selectBtFirmList" parameterType="com.risesun.business.domain.BtFirm" resultMap="BtFirmResult"> select id, dept_id, firm_name, firm_photo, firm_address, credit_code, principal, firm_tel, firm_phone,firm_intro, firm_info, firm_lng, firm_lat, release_status, release_time, order_num, deleted, create_by,create_time, update_by, update_time <if test="firmLng != null and firmLng != '' and firmLat != null and firmLat != ''"> ,round(st_distance_sphere(point(#{firmLng},#{firmLat}), point (firm_lng,firm_lat))/1000,2) distance </if> from bt_firm <where> <if test="firmName != null and firmName != ''"> and firm_name like concat('%', #{firmName}, '%')</if> <if test="releaseStatus != null and releaseStatus != ''"> and release_status = #{releaseStatus}</if> <if test="firmIds != null and firmIds.size > 0"> <foreach collection="firmIds" item="id" open="and id in (" separator="," close=")"> #{id} </foreach> </if> </where> order by order_num ASC, <if test="firmLng != null and firmLng != '' and firmLat != null and firmLat != ''"> distance ASC, </if> update_time DESC </select>5.mysql中查询使用 != 不等于会过滤掉null的情况及其原因分析和解决在写 SQL 条件语句时经常用到 不等于 != 的筛选条件。此时要注意此条件会将字段为 Null 的数据也当做满足不等于的条件而将数据筛选掉。(也就是说会忽略过滤掉为 null 的数据,导致数据不准确)。二、解决方案 要查出第三列只需将 SQL 改为如下语句 即可。SELECT * FROM A WHERE B1 != 1 OR B1 is Null 上面这种方法最通俗,网上也最多,但是我总是感觉效率太低。目前我使用的方法是:SELECT * FROM A WHERE IFNULL(B1,'') != 1<if test="voluntaryType != null and voluntaryType == '0'.toString()"> and IFNULL(voluntary_type,'') != '1'</if> <if test="voluntaryType != null and voluntaryType == '1'.toString()"> and voluntary_type = #{voluntaryType}</if>
2024年01月03日
19 阅读
0 评论
0 点赞
2024-01-03
开放本地MySQL数据库局域网远程访问
1.关闭防火墙(控制面板\系统和安全\Windows Defender 防火墙);2.修改数据库user表字段把本地数据库的mysql数据库的user表User字段为root的Host值由localhost改为%;3.刷新权限:flush privileges;
2024年01月03日
1 阅读
0 评论
0 点赞