user3046711
user3046711

Reputation:

mysql string group_concat giving me an error

i'm getting an error here when i try this sql ...

SELECT customers.customers_first_name GROUP_CONCAT(customers_groups.customers_hash SEPARATOR '') 
FROM customers INNER JOIN customers_groups ON (customers.hash = customers_groups.customers_hash) 
GROUP BY customers.customers_entry_date



CUSTOMERS DATABASE
`customers_id`, 
`customers_first_name`, 
`customers_surname`, 
`customers_telephone`, 
`customers_email`, 
`customers_telephone_active`, 
`customers_email_active`, 
`client_type`, 
`customers_hash`, 
`customers_entry_date`

CUSTOMERS_GROUPS
`groups_hash`
`customers_hash

Upvotes: 1

Views: 58

Answers (1)

Rohit.007
Rohit.007

Reputation: 3502

Ideally, you should post the error message with the question but check below solution.

SELECT customers.customers_first_name, GROUP_CONCAT(customers_groups.customers_hash SEPARATOR '') 
FROM customers INNER JOIN customers_groups ON (customers.hash = customers_groups.customers_hash) 
GROUP BY customers.customers_entry_date

SELECT customers.customers_first_name ,

"," was missing in the select statement before GROUP_CONCAT

Upvotes: 1

Related Questions