From: Ehsanul Hoque Date: 2009-09-28T08:29:41+09:00 Subject: Re: Counting words for visual details --_e2185153-f84d-434c-901a-116fa693c2e5_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable > I save each answer for each user=2C with the visual detail in one column > and the three words in an array in a single varchar column. E.g. for > Linear a user doing the survey might pick Word1=2CWord2=2CWord3. >=20 > What would be the best way to count the words picked for let's say > Linear? And also=2C count the ones most frequent. >=20 > ( Not sure it's best to ask here or in Rails forum but I suspect it > could be here with some array or hash trick.) Well=2C if you can create the query for the word array=2C then you can simp= ly use the size() method to count the objects in the array: word_array =3D ['Word1'=2C 'Word2'=2C 'Word3'] #query here instead word_array.size # =3D> 3 =0A= _________________________________________________________________=0A= Hotmail=AE has ever-growing storage! Don=92t worry about storage limits.=0A= http://windowslive.com/Tutorial/Hotmail/Storage?ocid=3DTXT_TAGLM_WL_HM_Tuto= rial_Storage_062009= --_e2185153-f84d-434c-901a-116fa693c2e5_--