My application is a video game I’m writing and I’m trying to write a script to move my creatures around the map.
so I am trying to return unique spawn_id,posx,posy combinations (only 1 row per unique combination) It doesn’t matter which one is returned id is my key field.
SELECT id,spawn_id,posx,posy,land,movelimit,next_turn FROM `game_moblist` WHERE 1 GROUP BY spawn_id,posx,posy
so given the data
id spawn_id posx posy
1 1 55 55
2 1 55 55
3 1 110 55
the query should return rows 1 and 3 (or 2 and 3 doesn’t really matter) but not 1,2, and 3.
You’re almost there.
You could also just return the list of IDs, and then join against that in other queries: