ä»æ¥ç¥ã£ãSQLé¢æ°ãGROUP_CONCAT
ä»æ¥ã¯MySQLã®ã話ã
ä¾ãã°ãããããã¼ãã«(shusi)ããã£ãã¨ãã¦
name neta ----- ------------- 太é ããã 太é ã¦ã è±å ãã«ã¿ã äºé ã¨ããµã¼ã¢ã³ 太é ã¨ã è±å ãã¾ã 太é ã¤ã« äºé ã¨ããµã¼ã¢ã³ è±å ãã è±å ããã 太é ãã 太é ããã è±å ãã¯ã 太é ã¨ããµã¼ã¢ã³ 太é 大ãã äºé ã¨ããµã¼ã¢ã³
ããã
name count netas ----- ------ ------------- 太é 8 ãã/ããã/ã¨ããµã¼ã¢ã³/ã¤ã«/ã¦ã/ã¨ã/ããã/大ãã è±å 5 ãã/ããã/ãã«ã¿ã/ãã¯ã /ãã¾ã äºé 3 ã¨ããµã¼ã¢ã³/ã¨ããµã¼ã¢ã³/ã¨ããµã¼ã¢ã³
ã¿ããã«ãããã
GROUP_CONCATã¨ããã®ããããã§ããã
MySQL :: MySQL 5.6 リファレンスマニュアル :: 12.19.1 GROUP BY (集約) 関数
SELECT name, count(name) as num, GROUP_CONCAT(neta order by neta separator '/') as netas FROM sushi GROUP BY name ORDER BY num DESC
ããã§
- 太éããã¯è¯ãé£ã¹ã
- è±åããã¯å¥³ã®åã«ãã¦ã¯è¯ãé£ã¹ã
- äºéããã¯ã¨ããµã¼ã¢ã³ã大好ã
ã¨ãããã¨ãä¸ç®çç¶ã§ããã
ããã§ã¯ã