..


Sponsored Links

How do I count the occurrences of a character within a field?

Unfortunately MySQL does not have a function specifically for this task, to this end, therefore. you need a little ingenuity '. Here's the query to count the occurrences of a given character (in the "a") within a text field:

 



 LENGTH SELECT (campo_di_testo) - LENGTH (REPLACE (campo_di_testo, 'a','')) AS count

 

In the same category ...
E-Learning
MS Access (Advanced) MS Access (Advanced)
Learn how to create and manage databases quickly and easily. Starting from 29 €.
MySQL (Course) MySQL (Course)
Management of open-source database. From 39 €.
SQL and Database (Course) SQL and Database (Course)
Create and manage relational databases. From 39 €.
Sponsored Links