gpt4 book ai didi

influxdb - 手动按特定顺序排序

转载 作者:行者123 更新时间:2023-12-04 08:06:01 25 4
gpt4 key购买 nike

我有以下查询:

SELECT mean("voltage") FROM "cells" WHERE 
("cell" = 'Cell 1' or "cell" = 'Cell 2' OR "cell" = 'Cell 3' OR "cell" = 'Cell 4' OR
"cell" = 'Cell 5' OR "cell" = 'Cell 6' OR "cell" = 'Cell 7' OR "cell" = 'Cell 8' OR
"cell" = 'Cell 9' OR "cell" = 'Cell 10' OR "cell" = 'Cell 11' OR "cell" = 'Cell 12' OR
"cell" = 'Cell 13' OR "cell" = 'Cell 14' OR "cell" = 'Cell 15' OR "cell" = 'Cell 16')
AND $timeFilter
GROUP BY time($__interval), "cell" fill(linear)
我的问题是涌入排序为字符串,所以我得到 Cell 1 然后是 Cell 10,我想要 Cell 1、Cell 2 ......,我怎样才能做到这一点?

最佳答案

您可以使用

ORDER BY SUBSTRING(cell, 6, 12) * 1;
哪里 SUBSTRING(test, 6, 12)将从开头和 * 1 中删除“Cell”将其余的转换为数字。

关于influxdb - 手动按特定顺序排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66221103/

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