I have this query in Ruby to fetch some data from the database:
@mastertest = connection.execute("select code_ver, date from mastertest")
So now I assume @mastertest is a 2-dimensional array containing all rows and columns
I try this to print everything out:
@mastertest.each do |row|
puts row[0]
end
And it prints the first column of all rows.
Now I want to find out the unique values from the first column of all rows and count the number of it's occurrence too. I know it can be done through Hash or Array. Can someone help me with this?