dttime10,
dttime11,
val
FROM
(
select
str0,
str1,
int10,
int11,
dttime10,
dttime11,
sum(value) as val,
row_number() OVER (
PARTITION BY str0,
str1,
int10,
int11,
dttime10,
dttime11
ORDER BY
sum(value)
) as number
from
factCube
INNER JOIN factTable USING (index)
group by
str0,
str1,
int10,
int11,
dttime10,
dttime11,
position
)
WHERE
number = 50
Получился такой запрос, можно ли его улучшить?
Пожалуйста... select str0, str1, int10, int11, dttime10, dttime11, sum(value) as val from factCube INNER JOIN factTable USING (index) WHERE row_number() OVER ( PARTITION BY str0, str1, int10, int11, dttime10, dttime11 ORDER BY sum(value) ) = 50 group by str0, str1, int10, int11, dttime10, dttime11, position
Обсуждают сегодня