Outputting MySQL data in a specific way

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
Ok, so I have a table with a couple of rows.
Each row having a unique X and Y Number (co-ordinates)
Example:
Row 1: x = 0, y = 0
Row 2: x = 0, y = 1
Row 3: x= 0, y = 2
blah blah
Row 20: x = 3, y = 4
And so on..

What I am wanting to do is output the data in a table so it looks like this -
Or even if 0,0 starts in the top left and the bottom right is 7,7

What approach do I take? I have tried a couple of things but none seem to work.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,142
2,468
Start with the lowest x value and the highest y value, then get everything with a BETWEEN() on x where y is the assigned value. Loop through that to get all rows until you have the max of x.
 

Users who are viewing this thread

Top