I have a little problem right here...
So all in all I have exactly two tables:
* resources (ID, resourcetype_ID, chunk_ID, position) * chunks (ID, x, y)
The first one stores some rows which belongs to the certain chunk. The second one just stores all the chunks with a different set of x and y as some kind of position.
My goal is to select all the resources that belong to a certain range of chunks. But I have made a mistake somewhere. I always get the wrong x and y positions, when I select the resources.
SELECT resources.*, chunks.x, chunks.y FROM resources, chunks where chunk_ID in (SELECT ID FROM chunks where x between 17185-1 and 17185+1 and y between 10846-1 and 10846+1) group by ID
This query above returns all the resources that belongs to the different chunks. But the returned x and y position is for all of them the same. Why does this happen?
(As you can see the resources with "chunk_ID" = 1 have the same x and y as the resources with "chunk_ID" = 5 ... even if those chunks have completely different x and y pairs...)
Normally all resources should have different x and y values regarding to the chunk they belong to.