Re: Need help for query, how could i do this with django ? or a raw SQL.

2006-03-25 Thread Andy Dustman
On 3/25/06, coulix <[EMAIL PROTECTED]> wrote: > > i got it working : > > def _module_get_top_users(limit): > cursor = db.cursor() > cursor.execute(""" > SELECT auth_users.username, COUNT(*) AS count > FROM auth_users,

Re: Need help for query, how could i do this with django ? or a raw SQL.

2006-03-24 Thread coulix
i got it working : def _module_get_top_users(limit): cursor = db.cursor() cursor.execute(""" SELECT auth_users.username, COUNT(*) AS count FROM auth_users, recettes_recipes WHERE auth_users.id=

Re: Need help for query, how could i do this with django ? or a raw SQL.

2006-03-24 Thread Andy Dustman
On 3/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > coulix wrote: > > Hello, > > I was trying to play with custom query but i didnt manage to get it > > working, > > I too could not get the custom query from the API reference working: > > polls.get_list( > select={ > 'choice_c

Re: Need help for query, how could i do this with django ? or a raw SQL.

2006-03-24 Thread [EMAIL PROTECTED]
coulix wrote: > Hello, > I was trying to play with custom query but i didnt manage to get it > working, I too could not get the custom query from the API reference working: polls.get_list( select={ 'choice_count': 'SELECT COUNT(*) FROM choices WHERE poll_id = polls.id' } ) Tryin

Re: Need help for query, how could i do this with django ? or a raw SQL.

2006-03-24 Thread Rock
Dropping down to the raw SQL level is easy... Assuming my_sql_command is a string with your select statement... from django.core.db import db cursor = db.cursor() cursor.execute( my_sql_command ) row = cursor.fetchone() result = row[0] You might prefer fetchall(), but I leave the data gather

Need help for query, how could i do this with django ? or a raw SQL.

2006-03-24 Thread coulix
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={

Need help for query, how could i do this with django ? or a raw SQL.

2006-03-24 Thread coulix
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={