Ahhh .. yes they do have commas in them. I'll remove the commas and try it again.
Thanks,
Umesh

Dan Baker wrote:
----- Original Message ----- From: "Umesh Persad" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Tuesday, January 16, 2007 10:32 AM
Subject: [sqlite] SQL query problem


Hi,
I was wondering if anyone can help with a problem I have having with SQL. I have a table 'people' in a Sqlite database with a column 'population'. All I want to do is to add up all the values in this column. When the data is in an
Excel file, the column adds up to 8,581,774.

I used the SQlite Database Browser (http://sqlitebrowser.sourceforge.net/)
to get the data into a Sqlite database and ran the following query:

SELECT SUM(population) FROM people

I am supposed to get 8,581,774 but instead I am getting 14898.38. I exported the data back out to a csv file and checked it in Excel and all the data was there
adding up to 8,581,774.

So is there something wrong with my query or should the query be different with
Sqlite?

I'm wondering if your population values have commas in them? "1,774" This *may* cause some trouble for the SUM function.
Just a thought.
DanB


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



--
Umesh Persad
Cambridge Engineering Design Centre (EDC)
The University of Cambridge, Department of Engineering,
Trumpington Street, Cambridge, CB21PZ, UK
Phone:  +44 1223 766958
Fax:    +44 1223 332662
Email:  [EMAIL PROTECTED]
Web:    http://www-edc.eng.cam.ac.uk/people/up209.html







-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to