I am using GROUP_CONCAT
in mysql query but the query gives me unexpected and unknown result. This is the query:
我在mysql查询中使用GROUP_CONCAT,但查询给了我意想不到的未知结果。这是查询:
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
The result is looking like this
结果看起来像这样
GROUP_CONCAT( DISTINCT ( categoryid ) ) // column
[BLOB - 10B] // result
I want comma separated string of categoryid but I don't understand why query gives this type of result and what is missing in the query.
我想要逗号分隔的categoryid字符串,但我不明白为什么查询会给出这种类型的结果以及查询中缺少的内容。
1 个解决方案
#1
2
Question still not clear but I guess this will solve your problem. Put a cast aroung group_concat like this:
问题仍然不明确,但我想这将解决您的问题。像这样放一个cast aroung group_concat:
cast(group_concat(DISTINCT(categoryid)) as char)
cast(group_concat(DISTINCT(categoryid))as char)
#1
2
Question still not clear but I guess this will solve your problem. Put a cast aroung group_concat like this:
问题仍然不明确,但我想这将解决您的问题。像这样放一个cast aroung group_concat:
cast(group_concat(DISTINCT(categoryid)) as char)
cast(group_concat(DISTINCT(categoryid))as char)