'Django multiple distinct values queryset for SQLDB

I'm trying to get a list of results that have distinct x and y values, but I also want to return color along with them.

Since I'm using an SQLDB I'm not allowed to use the fieldnames arg of distinct. Is there a good work around for this? All the examples I'm been looking up haven't been working out.

The query that I'm not allowed to run: queryset = Tile.objects.values('x', 'y', 'color').distinct('x', 'y')

Current Work Around: For now I'm just flagging old rows as retired and pulling everything else as not retired. Probably the right way of doing things, but I didn't want to add additional columns if not needed.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source