Saturday, April 9, 2011

Creating this query with django Models

Hi, I've this three models:

http://pastie.org/1775233

in SQL i've got this query:

SELECT servertool_status.id, time, lastname , guid , score
FROM servertool_status
INNER JOIN servertool_currentplayers
INNER JOIN servertool_player
ON servertool_status.id = servertool_currentplayers.status_id
AND servertool_currentplayers.player_id = servertool_player.guid
WHERE servertool_status.id = (
SELECT MAX(servertool_status.id) FROM servertool_status
)
GROUP BY guid;

is it somehow possible to get this with the django models objects?

thanks Thomas

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment