2

GROUP_CONCAT在 mysql 查询中使用,但查询给了我意想不到的未知结果。这是查询:

SELECT GROUP_CONCAT( DISTINCT (categoryid) )
FROM jos_community_groups
WHERE team_classification
IN (
      SELECT id
      FROM jos_league_classification
      ORDER BY winning_criteria ASC
   )
AND show_in_contact =1
AND team_state = 'Georgia'
AND categoryid
IN ( 
      SELECT sportstypeid
      FROM jos_gsa_tournament
      WHERE directorid =305
   )
ORDER BY categoryid, team_agegroup, team_classification

结果看起来像这样

GROUP_CONCAT( DISTINCT ( categoryid ) )  // column
[BLOB - 10B]                             // result 

我想要逗号分隔的 categoryid 字符串,但我不明白为什么查询会给出这种类型的结果以及查询中缺少什么。

4

1 回答 1

2

问题仍然不清楚,但我想这会解决你的问题。像这样对 group_concat 进行强制转换:

cast(group_concat(DISTINCT(categoryid)) as char)

于 2012-05-11T21:26:26.987 回答