当前位置:网站首页>mysql截取字符串去重,mysql 截取字符串 去重 拼接
mysql截取字符串去重,mysql 截取字符串 去重 拼接
2022-06-29 10:44:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
1:字符串截取
LEFT(guid_,LENGTH(guid_) – 5)//1001-1002-1003 截取为 1001-1002
2:判断是否存在某字符串中
IN(‘1001′,’1002′,’1003’)// where id in(xxxx) 可以用查询的某个字段直接 where id in (select id from xxxx)
3:根据某个字段去重复
在查询结果中加入COUNT (DISTINCT 想要根据去重的字段)//select name ,age,sex ,count(distinct name ) from xxx where xxx group by name , age, sex
4:字段拼接
GROUP_CONTACT(name,’:’,sex)//group_contact(‘小明’,’:’,’女’)-》“小明:女”
5:日期格式
DATE_FORMAT(date,’%Y-%m-%d’)// 20130806 ->2013-08-06
6:调用存储过程
CALL xxxxx
7:条件判断 case when 使用
SELECT CASE WHEN sex = 1 THEN “男” WHEN sex = 0 THEN “女” END AS sex
8:判断时间范围
created_at > SUBDATE(NOW(),INTERVAL 24 HOUR) AND created_at < NOW()//24小时内
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/132368.html原文链接:https://javaforall.cn
边栏推荐
- CTO专访:合见工软深化产品布局 加速国产EDA技术革新
- 软件工程导论——第五章——总体设计
- What are the pop, push, unshift, and shift of the (JS) array?
- 【高并发】缓存思路
- How to find out the wrong mobile number when querying MySQL
- After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
- [daily 3 questions (1)] judge the color of a grid on the chess board
- Qt学习03 Qt的诞生和本质
- 分布式缓存之Memcached
- How to test the performance of container platform, including stability, expansion efficiency and component performance
猜你喜欢

Hit the industry directly! The first model selection tool in the industry was launched by the flying propeller

Spark - one to one correspondence between task and partition and detailed explanation of parameters

Multi thread communication between client and server (primary version)

Evaluation of IP location query interface Ⅱ

信息技术应用创新专业人员(数据库)中级培训火热招生中(7月6-10日)

中科方德技术专家直播:如何基于 OpenStack、Ceph 构建私有云平台? | 第 27 期

Qt学习05 Qt Creator工程介绍

XML外部实体注入漏洞(一)

【每日3题(3)】重新格式化电话号码

9 easy to use JSON processing tools, greatly improving efficiency!
随机推荐
Self-Improvement! Junior college "counter attack" master of Zhejiang University, 3 SCI, and finally become a doctor of Tsinghua University!
【每日3题(2)】生成交替二进制字符串的最少操作数
Safety innovation practice | Haitai Fangyuan was invited to participate in the technical exchange Seminar on "network information innovation and value co creation in the digital age"
What is the experience of working in an IT company in Japan?
Exclusive interview with head of suss NIFT: the future of Web3 is inseparable from the governance of "everyone for me, I for everyone"
[HBZ sharing] principle of semaphore and countdownlatch
Go 单元测试入门实践
在日本的 IT 公司工作是怎样一番体验?
QT learning 09 calculator interface code reconstruction
[3 questions per day (2)] minimum operand for generating alternate binary strings
Pipeline aggregations pipeline aggregation-sibling-1
Qt学习01 GUI程序原理分析
[HBZ sharing] InnoDB principle of MySQL
Bs-gx-018 student examination system based on SSM
Uber前安全主管面临欺诈指控 曾隐瞒数据泄露事件
After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
The use of Fibonacci sequence and bubble sort in C language
Mastering the clever use of some shell wildcards will make us write with half the effort
【每日3题(1)】判断国际象棋棋盘中一个格子的颜色
【HBZ分享】AQS + CAS +LockSupport 实现ReentrantLock的原理