我有两列,它们是按另一列中的值计算的。计算列上的自定义排序
CASE
WHEN ACT.TotalScore > 850 THEN 'Cok Basarili'
WHEN ACT.TotalScore <= 850 AND ACT.TotalScore > 700 THEN 'Basarili'
ELSE 'Basarisiz' END as Basari,
CASE
WHEN ACT.TotalScore > 850 THEN 'rgba(123,192,67,1)'
WHEN ACT.TotalScore <= 850 AND ACT.TotalScore > 700 THEN 'rgba(253,244,152,1)'
ELSE 'rgba(243,119,54,1)' END as Renk
他们计算成功,并根据他们的点实际分配一种颜色。
ON GROUP BY
我用同样的CASE WHEN
太
总产量(与其他的选择元素ADN where子句等,并没有ORDER BY)
+---------------+--------------+---------------------+
| DenetimSayisi | Basari | Renk |
+---------------+--------------+---------------------+
| 35 | Cok Basarili | rgba(123,192,67,1) |
| 60 | Basarisiz | rgba(243,119,54,1) |
| 29 | Basarili | rgba(253,244,152,1) |
+---------------+--------------+---------------------+
我想根据做出的客户订单'伯萨里' 列,并试图此
ORDER BY CASE
WHEN ACT.TotalScore > 850 THEN 2
WHEN ACT.TotalScore <= 850 AND ACT.TotalScore > 700 THEN 1
ELSE 3 END
给出该错误
Msg 8127, Level 16, State 1, Line 36
Column "Activity.TotalScore" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
Msg 8127, Level 16, State 1, Line 37
Column "Activity.TotalScore" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
Msg 8127, Level 16, State 1, Line 37
Column "Activity.TotalScore" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
我不知道还有什么我可以尝试或我该如何解决这个问题。
你能显示你所有的查询吗? – gofr1