shabda napisaƂ(a):

> I have table say BlogEntries. Now to show an archive view I need to
> find the months for which at least one entry exists in the database.
> If I drop to raw SQL i can write to query to achieve this as,
> SELECT
> created_on
> , count( created_on )
> FROM `myapp_blogentry`
> GROUP BY year( created_on ) , month( created_on )
> LIMIT 0 , 30;
> Is there any way I can do this without dropping to raw sql?
> If I need to drop to raw sql, what can I do to make this query
> portable across databases?

See .dates() method:
http://www.djangoproject.com/documentation/db-api/#dates-field-kind-order-asc

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

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