• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

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?
 

JuggaloBrotha

Moderator
Staff member
Joined
Apr 23, 2011
Messages
146
Location
Lansing, MI; USA
Programming Experience
10+
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:
Code:
Select Count(*) As Count
From YourTable
Where NAME Like '%YourWord%'
Your example would be:

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