select sum(c.cost)
from (select x.num as x, y.num as y, max(priority) as maxpriority
from numbers x cross join
numbers y join
costs c
on x.num between c.x and c.x + c.deltax and y.num between c.y and c.y + c.deltay
where x.num between PIXELX and PIXELX and DELTAX and
y.num between PIXELY and PIXELY and DELTAY
group by x.num, y.num
) xyp join
costs c
on xyp.x between c.x and c.x + c.deltax and xyp.y between c.y + c.deltay and
xyp.maxpriority = c.priority
我试图获得2d中所选区域的“成本”,该区域由不同的区域大小填充,不同的成本按优先级相互重叠。 (如果一个区域低于另一个区域,则忽略它)
这是数字:
Collation Attributes Null Default Extra Action
1 num int(11) No None Change Drop Browse distinct values More
这是费用:
# Name Type Collation Attributes Null Default Extra Action
1 x int(11) No None Change Drop Browse distinct values More
2 y int(11) No None Change Drop Browse distinct values More
3 deltax int(11) No None Change Drop Browse distinct values More
4 deltay int(11) No None Change Drop Browse distinct values More
5 priority int(11) No None Change Drop Browse distinct values More
我错过了什么?代码可能存在错误。