[web2py] db.count()

2013-04-10 Thread Domagoj Kovač
Hi,

i have this line of code:

number_of_records = db().count(db.countries.id)

i am receiving an error:
class 'sqlite3.OperationalError' near ;: syntax error
(self=gluon.dal.SQLiteAdapter object, *a=('SELECT count(DISTINCT 
countries.id) FROM ;',), **b={})

What is wrong?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] db.count()

2013-04-10 Thread Marco Mansilla
i think it should be:

number_of_records = db(db.countries.id).select().count()

haven't tried it, but you must have all the rows selected to count.

 Hi,
 
 i have this line of code:
 
 number_of_records = db().count(db.countries.id)
 
 i am receiving an error:
 class 'sqlite3.OperationalError' near ;: syntax error
 (self=gluon.dal.SQLiteAdapter object, *a=('SELECT count(DISTINCT 
 countries.id) FROM ;',), **b={})
 
 What is wrong?
 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] db.count()

2013-04-10 Thread Domagoj Kovač
I tried Antonies code and it works. Thanks.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.