I have a column named log
which contains logging information. I need a query to select all rows in which the value today
appears two times or three times in my log column.
id log
1 today, yesterday, today, tomorrow, today
2 now, today, now
3 now, today, today
Select id from table if `today` appears three times in log column
The id:1 will be selected
This will do your job:
select * from table where ROUND (
(
LENGTH(log)
- LENGTH( REPLACE ( log, "today", "") )
) / LENGTH("today")
) >=3
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments