If the data were small I'd do a case statement, otherwise, create a table with the ranges and join that to your main table.
g -----Original Message----- From: Jonathon [mailto:thejunk...@gmail.com] Sent: Wednesday, December 31, 2008 5:16 AM To: General Discussion of SQLite Database Subject: [sqlite] Creating Histogram fast and efficiently :) Hello all, I have a column of numbers in a table, and I was wondering if it is possible to create a histogram out of it fast and efficiently? For example, assuming the data in the column is: 1, 5, 10, 12, 12, 15, 20, 20, 20.. I would like to return: 'less than 10' --> 2 'less than 20 and greater than or equal to 10' --> 4 'great than or equal to 20' --> 3 I hope that makes sense. I checked all over Google, and it seems that different databases seem to tackle this problem differently. So.. I was just curious how sqlite can help me make this calculation fast :) Thanks, J _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users