Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function not found: group_concat

I'm interesting in execute a query using the "group_concat" BigQuery function. When I execute the query directly in the BigQuery interface, the query ends successfully, but when I try to execute that query via Node js, the bellow error appeared:

errors:
   [ { domain: 'global',
       reason: 'invalidQuery',
       message: 'Function not found: group_concat at [4:3]',
       locationType: 'other',
       location: 'query' } ]

The code is not the problem since it executes a simple query without any problem.

My query:

SELECT
  st_hub_session_id,
  num_requests,
  group_concat( group.code, '|' ) as Codes
FROM
  table.name
GROUP BY
  st_hub_session_id,
  group_concat
LIMIT
  1000

Where could be the problem?

like image 711
bsmarcosj Avatar asked Feb 06 '23 11:02

bsmarcosj


1 Answers

Use STRING_AGG in standard SQL instead of the legacy GROUP_CONCAT. You can use standard SQL through the UI by unchecking "Use legacy SQL" under "Show Options" or else putting #standardSQL at the top of your query. See also Enabling Standard SQL.

like image 185
Elliott Brossard Avatar answered Feb 22 '23 23:02

Elliott Brossard