Tuesday, February 7, 2012

could i use a select?

Hi,
I've an Invoice Model:

class Invoice(models.Model):
...
number = models.IntegerField(...)
customer = models.ForeignKey()
date_invoice = ...
total_invoice = ...
...

To have the top ten customer can i do?
I have to use a select:

SELECT SUM(total_invoice) AS total FROM invoice_invoice GROUP BY
customer ORDER BY total DESC

or can I use django methods? How?

Thanks,
Vittorino.

--
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