nilesh1006
nilesh1006

Reputation: 165

Using GROUP_CONCAT in mysql query and getting unexpected result

I am using GROUP_CONCAT in mysql query but the query gives me unexpected and unknown result. This is the query:

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.

Upvotes: 2

Views: 171

Answers (1)

Nesim Razon
Nesim Razon

Reputation: 9794

Question still not clear but I guess this will solve your problem. Put a cast aroung group_concat like this:

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

Upvotes: 2

Related Questions