Reputation: 1183
I have following query :
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)
My issue is that influx sort as string so I get Cell 1 then Cell 10 where I would like to have Cell 1, Cell 2 ... ... , how can I achieve that ?
Upvotes: 2
Views: 269
Reputation: 547
You can use
ORDER BY SUBSTRING(cell, 6, 12) * 1;
Where SUBSTRING(test, 6, 12)
will remove "Cell " from the beginning and * 1
will transform the rest to number.
Upvotes: 2