Hello,
I was trying to play with custom query but i didnt manage to get it
working,
for example this one whcih i found on the mail list :

Polls.get_list(
    select={
        'choice_count': {
            db_table='choices',
            db_columns=['COUNT(*)']
            kwargs={
                where=['poll_id=polls.id']
            }
        }
    }
)


the 'choice_count' its like a select stuff AS choice_count ? what is it
used for.

Then related to my model :
i want the name of the top 5 users who wrote the most recipes.

Here is my model
RECIPE
 - name
 - stuf ect [...]
 - owner USER FK

USER (from django)
 - name

in sql i would do

SELECT auth_users.username, COUNT(*) AS count FROM auth_users,
recettes_recipes  WHERE auth_users.id=recettes_recipes.owner_id GROUP
BY username ORDER BY count DESC;

My eternal respect to the solver.


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