57

I have a query which uses the GROUP_CONCAT of mysql on an integer field.
I am using PHPMYADMIN to develop this query. My problem that instead of showing 1,2 which is the result of the concatenated field, I get [BLOB - 3B].

Query is

SELECT rec_id,GROUP_CONCAT(user_id)
FROM t1
GROUP BY rec_id

(both fields are unsigned int, both are not unique)

What should I add to see the actual results?

Jeemusu
  • 9,948
  • 3
  • 39
  • 64
Itay Moav -Malimovka
  • 48,785
  • 58
  • 182
  • 262

7 Answers7

88

Looks as though GROUP_CONCAT expects that value to be a string. I just ran into the same problem. Solved it by converting the int column to a string like so:

SELECT rec_id,GROUP_CONCAT(CONVERT(user_id, CHAR(8)))
FROM t1
GROUP BY rec_id

Figured I'd share in case you were still having an issue with this.

munch
  • 6,293
  • 4
  • 20
  • 26
44

According to the MySQL documentation, CAST(expr AS type) is standard SQL and should thus be perferred. Also, you may omit the string length. Therefore, I’d suggest the following:

SELECT rec_id, GROUP_CONCAT(CAST(user_id AS CHAR))
FROM t1
GROUP BY rec_id
scy
  • 6,486
  • 2
  • 24
  • 31
22

For me, this helped (found it in this blog post):

In my case the parameter to GROUP_CONCAT was string but the function still resulted in a BLOB, but converting the result of the GROUP_CONCAT worked.

CONVERT(GROUP_CONCAT(user_id) USING 'utf8')
Janne
  • 3,447
  • 5
  • 25
  • 34
20

Just above the query result (to the left) you will see +options. Press it and mark

Show BLOB contents

Itay Moav -Malimovka
  • 48,785
  • 58
  • 182
  • 262
  • Just to help out users who can't see the `+options`, not all configurations of phpmyadmin have it – Ejaz Jul 10 '15 at 17:09
0

You can do this:

set session group_concat_max_len = 512;

If group_concat_max_len is more than 512 the query will return byte[]. But you can pass to a string.

System.Text.Encoding.Default.GetString((byte[])DataTable.Rows[0][0]);
Misa Lazovic
  • 2,765
  • 9
  • 30
  • 38
Joe
  • 1
  • 2
0

In the latest Phpmyadmin

After running query, you will see some results and then dot ..

so just click on options (which is on top of the query result)

Then Just select

Full texts

radio button, default is Partial texts

Then press Go button and you will see full result

Devsi Odedra
  • 4,610
  • 1
  • 18
  • 29
-1

If you have access to the config.inc.php file in the phpMyAdmin directory, then I think the best solution is to change this line:

$cfg['Servers'][$i]['extension'] = 'mysql';

to this:

$cfg['Servers'][$i]['extension'] = 'mysqli';

If you have the mysqli extension available, use it. It is more secure, a bit more optimized, and it handles the BLOB type of utf-8 better by default. Your [BLOB] entries should start showing up as their values without having to add in any other special configuration options.

cwd
  • 47,510
  • 50
  • 154
  • 194