Şöyle yaparız
CREATE TABLE cat_weight_tableAS SELECT AVG(cat_weight) as cat_weight_avg, max(food_weight) - min(food_weight) as food_eaten FROM weight_stream WINDOW SESSION (600 seconds) WHERE food_weight < 1100 and cat_weight > 5800 and cat_weight < 6200 GROUP BY cat_name HAVING COUNT(*) > 4; SELECT TIMESTAMPTOSTRING(windowstart, 'dd/MM/yyyy HH:mm:ss'), TIMESTAMPTOSTRING(windowend, 'dd/MM/yyyy HH:mm:ss'), (windowend-windowstart) / 1000 as eat_seconds, ROUND(cat_weight_avg) AS cat_weight_grams, ROUND(food_weight_max - food_weight_min) AS food_eaten_grams, cnt FROM cat_weight_table WHERE cat_name = 'snowy';
No comments:
Post a Comment