gpt4 book ai didi

MySQL1054 - 'Field List' 中的未知列

转载 作者:行者123 更新时间:2023-11-29 10:10:25 27 4
gpt4 key购买 nike

SELECT 
id,
Prospect_Id,
GROUP_CONCAT(Current_Status ORDER BY id) AS myview,
GROUP_CONCAT(myview) AS myview1
FROM prospectdata1
GROUP BY Prospect_Id
HAVING myview REGEXP 'PHONE_FOLLOW_UP.*DUPLICATE'

我想在第二组中显示我的 View 数据..

最佳答案

您可以使用子查询,因为此时列别名对于选择的不同列不可见。我假设您需要第二级聚合,并且 Prospect_Id 唯一标识一行,因为您没有按 id 进行分组。

使用子查询:

SELECT
id, Prospect_Id, myview, GROUP_CONCAT(myview) AS myview1
FROM (
SELECT
id, Prospect_Id, GROUP_CONCAT(Current_Status ORDER BY id) AS myview,
FROM prospectdata1
GROUP BY Prospect_Id
HAVING myview REGEXP 'PHONE_FOLLOW_UP.*DUPLICATE'
) t
GROUP BY Prospect_Id

关于MySQL1054 - 'Field List' 中的未知列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51058855/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com