mysql is very strong, popular database stytem using for mainly inphp mysql web developmentsolution. in web application development sometime developer store data in comma(,) or pipe (|) etc formats. finding value(s) from comma seperate mysql has regexp (regular express) function. use this function developer can search or filer one or multiple string value in your field data. given below example to understand in detail how to use finding value(s) from comma seperate in mysql database field.
MySQL database table structure :
employee_hobbyid hobbies--- --------1Travelling2 Suring the Internet3 Reading4 Swimming5 Meeting Friends6 Cooking. .. .10 Watching Movieemployeeidhobby_ids--- ---------1 1,4,3,6,1021,3,4,1037. .. .10 3,5,6,9
1. Finding single id in Comma seperate string value (Get all employee id who has hobby “Swimming”) :
SELECT id FROM employee WHERE hobby_ids REGEXP "[[:<:]](4)[[:>:]]"
2: Find multiple id in comma separated string (Get all employee ids who has Travelling,Swimming,Watching Movie hobby) :
SELECT id FROM employee WHERE hobby_ids REGEXP "[[:<:]](1|4|10)[[:>:]]"
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号