I have a
Jdatabasetable having a comma separated field. What would be the best way (according to Joomla coding standards) to count the number of elements separated by commas. Like in the case below :
comma separated values
It should return : 9
If I am not wrong, one of the ways to achieve it using
mysql would be this :
SELECT (LENGTH(column_name) - LENGTH(REPLACE(column_name,",","")) + 1) AS MyColumnCounts FROM table_name;
But is this the best way?
Help would be appreciated.