【问题标题】:mysql string group_concat giving me an errormysql 字符串 group_concat 给我一个错误
【发布时间】:2018-06-12 15:22:07
【问题描述】:

我在尝试这个 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

【问题讨论】:

  • SELECT customers.customers_first_name GROUP_CONCAT(customers_groups.customers_hash SEPARATOR '')缺少逗号来分隔列。应该是SELECT customers.customers_first_name, GROUP_CONCAT(customers_groups.customers_hash SEPARATOR '')...我投票关闭这个问题,因为它看起来像是一个简单的印刷错误。
  • 请在提出此类问题时发布错误消息

标签: mysql sql group-concat


【解决方案1】:

理想情况下,您应该发布带​​有问题的错误消息,但请查看以下解决方案。

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 ,

"," 在 GROUP_CONCAT 之前的 select 语句中缺失

【讨论】:

    猜你喜欢
    • 2019-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-28
    • 1970-01-01
    相关资源
    最近更新 更多