1

I want to fetch primary key of all rows of one table in a single query.

I implement it using query --

SELECT GROUP_CONCAT( id SEPARATOR  ',' ) AS ids
FROM tbl_facebook_users
WHERE facebook_user_id
IN ( 336120419901063, 10205028697461204 )

It is giving result as:

Result :-

ids
-----------
[BLOB - 4B]

What is the solution to implement this feature and get correct result??

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

3 Answers3

0

With the reference to this post : using group_concat in PHPMYADMIN will show the result as [BLOB - 3B]

CONVERT(GROUP_CONCAT( id SEPARATOR  ',' ) USING 'utf8')
Community
  • 1
  • 1
tejashsoni111
  • 1,405
  • 1
  • 18
  • 34
0

use this Show BLOB contents and don't use SEPARATOR in your query if you want SEPARATOR like ',' cause in the MySQL by default SEPARATOR is ','

0

Problem Solved by using following query :

select CONVERT(GROUP_CONCAT(id) USING utf8) as ids from tbl_facebook_users

It bydefault separate ids by comma ','

If you want to use any other separator (say ';') use it as --

select CONVERT(GROUP_CONCAT(id SEPARATOR ';' ) USING utf8) as ids from tbl_facebook_users