简体   繁体   中英

How can i get middle values in particular column in SQL

How can i get middle values in particular column in SQL 5.6, MySQL Workbench ie :

5014.**160201**.1200.1-2 here i need the value **160201**

您可以使用substring_index()根据句点分隔符获取第二个值:

select substring_index(substring_index(col, '.', 2), '.', -1) as second_part

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM