| | |
Trying to find character occurrences in table field using SUM???
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 10
Reputation:
Solved Threads: 0
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.
How would I return a SCORE for how many occurrences? For example, 7 occurrences, SCORE = 7.
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.
sql Syntax (Toggle Plain Text)
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.
![]() |
Other Threads in the MySQL Forum
- Previous Thread: what is wrong with this code?
- Next Thread: Select SUM (All Fields in table)
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





