>
> For instance, taking  the example table below  I would need to show
> that UserID 1 has 280 "REG" points and 150 ZZZ points.
>
> User ID-- Points ---- Points_Type
> 1             200          Reg
> 1               80          Reg
> 1              100         zzz
> 1                50         zzz
> 2              100         Reg
> 2              100         xyz
>

Instinctively, it feels like custom SQL with "group by" would do this
most efficiently. Basically, in this case, you want to group by user_id
and points_type and count points. Here's a good article by Malcolm --
it shows, among other things, how one would wrap custom SQL inside a
manager.

http://www.pointy-stick.com/blog/2006/06/14/custom-sql-django


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to