R
R
Roman Govorov2019-09-20 09:46:11
MySQL
Roman Govorov, 2019-09-20 09:46:11

How to count how many specific characters are in a string using SQL?

There is an array with commas, I store it in the database, how to calculate how many people are employed there?
Subsequently, I will need to display the values ​​​​where more, let's say 5 busy.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lazy @BojackHorseman MySQL, 2019-09-20
@RGameShow

replace all commas with an empty string and calculate the difference in string lengths

G
gulitskiy, 2019-09-20
@gulitskiy

select len('test, with, commas,,,') - len(REPLACE('test, with, commas,,,', ',', ''))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question