On 06/29/11 11:22 AM, Gilles Ganault wrote: > Hello > > Using a table that lists people and the zipcode where they live, I > need to compute the percentage of those living in, say, NYC. > > I googled for this, but I'm not sure how to do this in SQLite. > > I wonder if it's done through a sub-query or maybe some temporary > variable? > > This computes the absolute: > SELECT COUNT(rowid) FROM people WHERE zip="12345"; > What about
SELECT (COUNT(rowid)*100)/(select count(*) from people) FROM people WHERE zip="12345"; /Roger _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users