Djangoists:

I have a database table like this...

  red, 1
  red, 2
  red, 15
  blue, 18
  blue, 20

...and I want to read it into an array like this:

  [ ['red', [1,2,15]], ['blue', [18,20]], ]

Of course I can use values_list('color', 'number'), and then re-pack
the array with a for-loop.

Do QuerySet aggregations and annotations offer some way to push that
query into the database?

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to