There is such a request, in two versions:
SELECT order_id, x as x1, y as y1, MAX(x)+1 as x2, MAX(y)+1 as y2 FROM `all_items` where order_id>0 group by order_id SELECT order_id, MIN(x) as x1, MIN(y) as y1, MAX(x)+1 as x2, MAX(y)+1 as y2 FROM `all_items` where order_id>0 group by order_id both work the same way, runtime one to one to ms.
Judging by the documentation, only the second request is correct, in this case I can say lucky that x1 and y1 need just the minimal ones from the set, and if you needed something else, how to pull out the remaining columns from the selected rows?