before comma total row count

ulaskayalar

New member
Joined
Apr 14, 2019
Messages
1
Programming Experience
1-3
Hello there,

I need to find the total number of data with MYSQL, but the data I store is not like standard data. As an example, before comma 'ahmet', how many are there in this column?

ID NAME
1 ahmet, mehmet, ayse, tugce
2 mehmet, fatih, ayse, tugce
3 ahmet, mehmet, furkan, tugce
4 kaan, ali, tugce, ahmet

I want to find a total of 'ahmet' data. There are 3 Ahmet in the column NAME. How can I find?
 
Would the same word appear more than once per line?
For example: would "ahmet" appear more then once per record?

If not, then the easiest way would be to do a Count() query with a where clause that uses a like, such as:
C#:
Select Count(*) As Count
From YourTable
Where NAME Like '%YourWord%'

Your example would be:

C#:
Select Count(*) As Count
From YourTable
Where NAME Like '%ahmet%'
 
Back
Top Bottom