Have a table roasts that has three columns country, country2, country3. The columns are for indicating which countries a blend of coffee comes from. It, therefore, goes that a country name could appear in any one of the three columns. Whilst I can do a count on any given column, I'd like to count how many times a value appears in all three of the country columns.
I'd like to do this in Rails/ActiveRecord. I've got as far as the below SQL, but this output isnt right:
SELECT country, country2, country3, COUNT(*) AS CountryCount FROM roasts GROUP BY country, country2, country3;
I suspect it's how I'm grouping.

altitude,processandvarietyHowever I don't know what all these values are, and am leaving it to the user to create these.