我有一张这样的桌子:
IntPoint.newRangeQuery(String field, int lowerValue, int upperValue)
我想在连续的行中找到最小值和最大值,其输出应如下所示:
function createGrid(size) {
document.styleSheets[0].cssRules[3].style["grid-template-columns"] = "repeat(" + size + ", 1fr)"
document.styleSheets[0].cssRules[3].style["grid-template-rows"] = "repeat(" + size + ", 1fr)"
console.log('createGrid');
for (i = 0; i < size*size; i++) {
const grid = document.createElement('div');
grid.classList.add('grid');
grid.style.cssText = 'color: #cccccc; background: #cccccc; border: solid 1px lightgrey;';
screen.appendChild(grid);
// Add listener to grid cell
grid.addEventListener('mouseover', (e) => {
e.target.style.background = '#0d0d0d';
})
}
}
有人可以帮我吗?
答案 0 :(得分:0)
假设您有id
列,它定义了consecutive rows
,那么您可以
with t (id, name , value ) as (
values
(1, 'alpha',90),
(2, 'beta',105),
(3,'beta',44),
(4,'beta',56),
(5,'gamma',22),
(6,'beta',111),
(7,'beta',99)
)
select name, min(value), max(value) from (
select id, name, value,
row_number() over(order by id) -
row_number() over(partition by name order by id) as grp
from t
) tt
group by name, grp
order by min(id)