I have a table with this value type 20 | 10 | 5 | 8 | 19 | (with separator)
I need to select rows where the first value (e.g. after explosion) is less than 20.
$arr = explode("|", "goal_times"); $first_goal_time = $arr[0];
But how to do it in Mysql query?
In general, you shouldn't have multiple delimited values ββin the same column. In this case, you can get away withSUBSTRING_INDEX()
SUBSTRING_INDEX()
SELECT * FROM yourtable WHERE SUBSTRING_INDEX(yourcolumn,'|',1) < 20;