Hi there! Im trying to get a SCORE result for how many times a character is present in a table field.

However, my SQL query only returns a SCORE of 1 if the character is present in the field. Where as I need it to tell me how many are in the table field.

SELECT SUM(if(field-name LIKE "%i%", 1, 0 )) FROM table WHERE id = '1'

How would I return a SCORE for how many occurrences? For example, 7 occurrences, SCORE = 7.

Look at this, hopefully this is what you need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.