当前位置:网站首页>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
边栏推荐
- 软件工程导论——第五章——总体设计
- Unity learning notes --vector3 how to set default parameters
- 重建中国科研自信——2022最新自然指数排行榜(Nature Index 2022 )公布,中国的研究产出增幅最大...
- (JS) array methods: slice and slice
- [HBZ sharing] InnoDB principle of MySQL
- [HBZ sharing] principle of semaphore and countdownlatch
- 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"
- 中国计算语言学大会、全国知识图谱与语义计算大会赛题火热进行中
- (JS) array flat
- Getting started with the lvgl Library - Animation
猜你喜欢

喜报|海泰方圆通过CMMI-3资质认证,研发能力获国际认可

Exclusive interview with CTO: the company has deepened the product layout and accelerated the technological innovation of domestic EDA

Live broadcast by technical experts from China Kuwait Fangde: how to build a private cloud platform based on openstack and CEPH| Issue 27

适合小白的树莓派opencv4.0安装

Qt学习09 计算器界面代码重构

Encore une fois, le chemin de l'amélioration de redis Cloud

美创入选信通院“业务安全推进计划”首批成员单位

影响LED封装散热主要因素有哪些?

Self-Improvement! Junior college "counter attack" master of Zhejiang University, 3 SCI, and finally become a doctor of Tsinghua University!

Qt学习02 GUI程序实例分析
随机推荐
Good news | Haitai Fangyuan has passed the cmmi-3 qualification certification, and its R & D capability has been internationally recognized
Qt学习06 窗口部件及窗口类型
What is the experience of working in an IT company in Japan?
Today in history: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born
X-FRAME-OPTIONS web page hijacking vulnerability
影响LED封装散热主要因素有哪些?
Hit the industry directly! The first model selection tool in the industry was launched by the flying propeller
【HBZ分享】AQS + CAS +LockSupport 实现ReentrantLock的原理
What are the main factors that affect the heat dissipation of LED packaging?
TTL serial port learning infrared remote control module can be extended to network control
(JS) isnan() method determines the reason why undefined is true
Modbustcp protocol network learning single channel infrared module (medium shell version)
(JS) responsibility chain mode
Qt学习04 Hello Qt
Micro blog comment architecture design
Evaluation of IP location query interface Ⅱ
Mastering the clever use of some shell wildcards will make us write with half the effort
The use of variables in shell that you have to be familiar with
XML external entity injection vulnerability (I)
Oracle NetSuite 助力 TCM Bio,洞悉数据变化,让业务发展更灵活