这是我的样本表,是否有可能获得动物的独特价值并用逗号来表示其字母并计算特定动物的字母?
查询:选择动物,来自宠物的信;
+--------------+--------------+
| animals | letter |
+--------------+--------------+
| dog | d |
| dog | o |
| dog | g |
| cat | c |
| cat | a |
| cat | t |
| mouse | m |
| mouse | s |
| mouse | e |
+--------------+--------------+
这是我的预期输出,计算得到总数的字母,计算逗号符号前的每个项目,:
+--------------+--------------+--------------+
| animals | letter | total |
+--------------+--------------+--------------+
| dog | d,o,g | 3 |
| cat | c,a,t | 3 |
| mouse | m,s,e | 3 |
+--------------+--------------+--------------+