From: Courtney Fay Date: 2012-01-26T07:16:51+09:00 Subject: Ruby Database Query with Grouping I am working in an application that has a Lucene and apache derby database. As my ruby skills are quite new, I am not sure where ruby ends and the application begins. At this point, I am trying to run some counts for data that has been indexed in the system. Attached is the beginning of a script. I know it's wrong. Let me preface with that. What I am trying to get is different counts, and group them by a piece of captured metatdata called "DateProcessed". What I would end up with is something like Date Processed - Count of Items - SizeBytes of Items - Immaterial Items - SizeBytes of Immaterial Items - etc 1/1/12 - 500 - 20934823 - 210 - 239048 1/9/12 - 1000 - 40102983 - 330 - 435875 etc. What I get with the current attached script is this: 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 1/1/12 - 500 - 20934823 - 210 - 239048 etc. Can anyone help me? I am hoping that as I learn to fish, my questions will get better and I will become more independent. Attachments: http://www.ruby-forum.com/attachment/6934/countsbydate.rb -- Posted via http://www.ruby-forum.com/.