Hi guys.

I have a date in my database. And i want to list all years and months
in that, without duplicates. For an example i want to print out (only
if they exists in the database):

2008:
January
August
December

2007:
September
December

I can get the data out without duplicates with this SQL query:
SELECT DATE_FORMAT(my_date_field, '%Y %m') AS year_month FROM mytable
GROUP BY year_month

This will give me a couple of rows which i will work on in python to
get it to work for my solution. Is there an easier way? And can i get
rid of the SQL and use "pure" django models?

Thanks.
Kasper Grubbe


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to