gpt4 book ai didi

mysql - MSSQL CONCAT 查询抛出错误

转载 作者:行者123 更新时间:2023-11-29 07:44:29 24 4
gpt4 key购买 nike

我尝试在 MSSQL 2008 R2 中执行以下查询,但它抛出错误。问题是:

    SELECT (n_artifactType+(' '+ n_actionPerformed)) AS actionperformed, 
COUNT(n_actionPerformed) total FROM notifications WHERE n_project='JupiterQA'
GROUP BY actionperformed order by n_actionPerformed;

错误是:

Msg 207, Level 16, State 1, Line 1
Invalid column name 'actionperformed'.

使用“actionperformed”作为别名,即使它抛出错误。如何执行上述查询而不出错。

最佳答案

从表面上看,actionperformed 是一个别名,而不是 group by 子句所需要的实际表字段(或表达式)。

建议改用group by (n_artifactType+(' '+ n_actionPerformed))

有趣的是,order by 会对别名感到满意。

关于mysql - MSSQL CONCAT 查询抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28230045/

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