在当前查询中使用 round 时需要帮助
Need assistance in using round on a current query
SELECT
(TS_LEXIZE('english_stem',
UNNEST(STRING_TO_ARRAY(
REGEXP_REPLACE(feedback, '[^a-zA-Z]+', ' ', 'g'),
' ')
)))[1] AS token,
AVG(rating) AS avg_rating
FROM customer_survey
GROUP BY 1
HAVING COUNT(1) >= 3
ORDER BY 2 DESC
;
我有以下查询,如果你想将评分限制为小数点后两位,你会在哪里添加 ROUND ()?
SELECT
(TS_LEXIZE('english_stem',
UNNEST(STRING_TO_ARRAY(
REGEXP_REPLACE(feedback, '[^a-zA-Z]+', ' ', 'g'),
' ')
)))[1] AS token,
ROUND(AVG(rating)) AS avg_rating
FROM customer_survey
GROUP BY 1
HAVING COUNT(1) >= 3
ORDER BY 2 DESC
;
通过在 avg 之前添加回合,我得到了它。
SELECT
(TS_LEXIZE('english_stem',
UNNEST(STRING_TO_ARRAY(
REGEXP_REPLACE(feedback, '[^a-zA-Z]+', ' ', 'g'),
' ')
)))[1] AS token,
AVG(rating) AS avg_rating
FROM customer_survey
GROUP BY 1
HAVING COUNT(1) >= 3
ORDER BY 2 DESC
;
我有以下查询,如果你想将评分限制为小数点后两位,你会在哪里添加 ROUND ()?
SELECT
(TS_LEXIZE('english_stem',
UNNEST(STRING_TO_ARRAY(
REGEXP_REPLACE(feedback, '[^a-zA-Z]+', ' ', 'g'),
' ')
)))[1] AS token,
ROUND(AVG(rating)) AS avg_rating
FROM customer_survey
GROUP BY 1
HAVING COUNT(1) >= 3
ORDER BY 2 DESC
;
通过在 avg 之前添加回合,我得到了它。