ok, can you print here what is the result of :

db.contadores.id_impressora._count(distinct=db.contadores.id_impressora)

(mind the _ before count.)

If you can fire off queries on your db using another tool than web2py 
(let's say, phpmyadmin), try to copy the resulting string into that and 
watch if the query raises an error.

Il giorno venerdì 9 marzo 2012 13:02:49 UTC+1, Fabiano Faver ha scritto:
>
> MySQL
>
> Em sexta-feira, 9 de março de 2012 08h59min46s UTC-3, Niphlod escreveu:
>>
>> what db are you using ?
>>
>>
>> Il giorno giovedì 8 marzo 2012 15:20:17 UTC+1, Fabiano Faver ha scritto:
>>>
>>> I`m trying to select distinct printers used in each day but i`m not 
>>> managing to use the distinct argument
>>>
>>> count = db.contadores.id_impressora.count()
>>> for row in db((db.contadores.id
>>> >0)&(db.contadores.data<=today)).select(db.contadores.data,count,groupby=db.contadores.data):
>>>         print row.contadores.data, row[count]
>>>
>>> if I use something like
>>>     
>>>   db.contadores.id_impressora.count(distinct=db.contadores.id_impressora)
>>>
>>> it gives:
>>>
>>> Traceback (most recent call last):
>>>   File "C:\web2py\gluon\restricted.py", line 204, in restricted
>>>     exec ccode in environment
>>>   File "C:/web2py/applications/OPM/controllers/default.py" 
>>> <http://127.0.0.1:8000/admin/default/edit/OPM/controllers/default.py>, line 
>>> 581, in <module>
>>>   File "C:\web2py\gluon\globals.py", line 172, in <lambda>
>>>     self._caller = lambda f: f()
>>>   File "C:/web2py/applications/OPM/controllers/default.py" 
>>> <http://127.0.0.1:8000/admin/default/edit/OPM/controllers/default.py>, line 
>>> 516, in timeline_opm
>>>     count = db.contadores.id_impressora.count(distinct=('id_impressora'))
>>> TypeError: count() got an unexpected keyword argument 'distinct' 
>>>
>>>
>>> How can I use distinct count here?
>>>
>>

Reply via email to