1
I have a field in a table with data separated by comma: condicao_pagamento: 20,25,35,45,50
.
How do I count the number of comma-separated items using Mysql only?
1
I have a field in a table with data separated by comma: condicao_pagamento: 20,25,35,45,50
.
How do I count the number of comma-separated items using Mysql only?
0
Check if this is what you want:
LENGTH(fooCommaDelimColumn) - LENGTH(REPLACE(fooCommaDelimColumn, ',', ''))
Browser other questions tagged mysql sql
You are not signed in. Login or sign up in order to post.
I had found this code a few days ago, it works almost perfectly. However, I thought this was not the correct way to count the number of items separated by comma. Do you know if there are any commands like
FIND_IN_SET
orIN
, specific to count items separated by comma, without the need to perform this "calculation"?– Adriano de Azevedo
I don’t, and from the research I’ve done I couldn’t find any function that could do that...
– jsantos1991