PDA

View Full Version : sqlite3: count records



gvanassche
02-25-2010, 02:23 PM
Hi all, I tried this but this does not work:


totalrecords=db:exec("SELECT COUNT(*) AS id FROM table")

Does anybody how to count records without making a loop & a counter. The table I need to query is really big.

thanks

gert

jassing
02-25-2010, 08:28 PM
select sum(1) as RecordCount
would work too -- but you shouldn't have to scan thru any records -- should be just a single record.

gvanassche
02-26-2010, 07:15 AM
thanks Jassing!