Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は2つのテーブルを持っています:
regions <id> points <region_id, x, y>
領域ごとに正確に4つのポイントがあり、これらのポイントが長方形を表すと仮定すると、このビューを表示するSQLクエリはありますか?
rectangular_regions <region_id, x1, y1, x2, y2>
?
SELECT region_id, MIN(x) AS x1, MIN(y) AS y1, MAX(x) AS x2, MAX(y) AS y2 FROM points GROUP BY region_id.