从mysql中的逗号分隔字符串中获取特定值

I have an issue that I am stuck in,

I have a table called wpg_original_word with field tags, which contains comma separated values and what I want to achieve is search for tags which are starting with the letter 'd'

I have written the query

SELECT DISTINCT tags FROM wpg_original_word  WHERE tags LIKE 'd%' ;

It returns the whole string like 'Diabetes, Nutrition, Dietician' , but I want only the Diabetes, Dietician.

Any help?

You could split the string with PHP, use the following code

<?php

$string = 'Diabetes, Nutrition, Dietician';
$array = explode(',', $string);
$result = array();
foreach ($array as $part) {
    if (substr(strtolower(trim($part)),0,1) == 'd') {
        array_push($result, trim($part));
    }
}

var_dump($result);

See it in action here. http://codepad.org/SVk7FPx9

You can use in_array() to check for a string in your query and then print it.